繁体   English   中英

FaceBook共享在android中不起作用

[英]FaceBook Share Doesn't Work in android

你好我想实现在Facebook上的文字交流,我已经完成这些步骤后,创建了必要信息的Facebook应用程序,我实现Facebook分享在我的应用程序,每当我试图用我的账号发布在Facebook上的消息( 这是我已用于创建appID )它已发布在facebook上,但是如果我尝试使用其他Facebook帐户发布该消息,则不会,该帐户已登录,但不会在墙上发布该消息。一个帮助我摆脱这个问题,谢谢

请参阅https://stackoverflow.com/a/15783274/2771869

使用Facebook SDK从“用户墙上的共享”中获取:

private void share() {
    Bundle bundle = new Bundle();
    bundle.putString("caption", "Harlem Shake Launcher for Android");
    bundle.putString("description", "Your android can do the Harlem Shake. Download it from google play");
    bundle.putString("link", "https://play.google.com/store/apps/details?id=mobi.shush.harlemlauncher");
    bundle.putString("name", "Harlem Shake Launcher");
    bundle.putString("picture", "http://shush.mobi/bla.png");
    new WebDialog.FeedDialogBuilder(mContext, mySession, bundle).build().show();
}

如果您需要登录(将其添加到您需要登录/共享的位置的活动中):

Session.openActiveSession(this, true, new Session.StatusCallback() {

    @Override
    public void call(Session session, SessionState state, Exception exception) {
        if(session.isOpened()) {
            share();
        }
    }
});

您将需要添加到您的活动中:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch(requestCode) {
    default:
        if(Session.getActiveSession() != null) //I need to check if this null just to sleep peacefully at night
            Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
        break;
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM