Facebook发布图片共享链接不工作?

时间:2016-03-16 12:41:58

标签: android facebook facebook-graph-api facebook-fql

当我们通过我的Android应用程序在Facebook上发布图像时,它已成功发布,但当我们在Facebook应用程序(在移动设备上)点击该帖子时,会出现一个Toast" 那里&#39 ;打开这个应用程序的问题。"但是当在WEB中打开并单击该发布的图像时,它将成功重定向到共享链接。 我已经使用此代码在Facebook上分享帖子。

GraphRequest request = GraphRequest.newPostRequest(AccessToken.getCurrentAccessToken(),
                    "me/feed", null, new GraphRequest.Callback() {

                        @Override
                        public void onCompleted(GraphResponse response) {
                            Log.i(TAG, response.toString());
                            //checkPostStatusAndEnableButton();

                        }
                    });
            Bundle postParams = request.getParameters();
            postParams.putString("link",post_url);
            postParams.putString("caption", caption);

            request.setParameters(postParams);
            request.executeAsync(); 

我们是否对移动设备的网址使用了其他一些操作?

1 个答案:

答案 0 :(得分:0)

试试这个:

private static List<String> PERMISSIONS = Arrays.asList("public_profile","user_photos","user_videos", "email","user_likes","user_posts",
                                                "user_hometown", "user_location","user_about_me","user_birthday",
                                                "user_friends","user_relationship_details");

LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
                    @Override
                    public void onSuccess(LoginResult loginResult) {
                    // App code
                        Log.i(TAG,"onSuccess registerCallback");
                    }

                    @Override
                    public void onCancel() {
                    // App code
                        Log.i(TAG,"onCancel registerCallback");
                    }

                    @Override
                    public void onError(FacebookException exception) {
                        // App code
                        Log.i(TAG,"onError registerCallback");
                    }
         });

然后调用此共享链接方法:

private void shareLink() {
        ShareLinkContent content = new ShareLinkContent.Builder()
                .setContentUrl(Uri.parse("https://developers.facebook.com"))
                .build();
        ShareDialog shareDialog = new ShareDialog(this);
        shareDialog.show(content, ShareDialog.Mode.AUTOMATIC);
    }