简体   繁体   中英

Share text on Facebook using sdk

I am working on an android app in which I am sharing content on facebook. I am able to share link, image. But i am unable to send when i only post text on facebook. I did not get any thing. I am using following code for share on facebook.

Bundle bundle = new Bundle();
bundle.putString("name", webPageContent);
bundle.putString("message", webPageContent);
FeedDialogBuilder feedDialog = new WebDialog.FeedDialogBuilder(FacebookShareActivity.this,Session.getActiveSession(),bundle)
    .setOnCompleteListener(new OnCompleteListener() {

        @Override
        public void onComplete(Bundle values,
                FacebookException error) {
            // TODO Auto-generated method stub
            if (error == null) {
                // When the story is posted, echo the success
                // and the post Id.
                final String postId = values.getString("post_id");
                if (postId != null) 
                {
                    Toast.makeText(FacebookShareActivity.this, "Posted story, id: "+postId, Toast.LENGTH_SHORT).show();
                }
            }
        }

    });

feedDialog.build().show();

Please see the docs for the feed dialog: https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.2

As you can see, there's no message property. This is because prefilling the status update for the user is against platform policies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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