1
votes

I have a text in my android application and I want the user to be able to click the FB Share button in the app and get this text posted on their own wall.

So far I've been following this tutorial:

https://developers.facebook.com/docs/android/share

and it is only good for either sharing a link (I dont want to share a link) or bringing up the share status dialog, but it is empty.

how can I populate that dialog with the text I want to populate it with?

this is my code

private void shareOnFacebook(String textToBeShared) {
    if (FacebookDialog.canPresentShareDialog(a, FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
        // Publish the post using the Share Dialog
        FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(a).setCaption(textToBeShared).build();
        a.uiHelper.trackPendingDialogCall(shareDialog.present());
    } else {
        publishFeedDialog();
    }

} // End of shareOnFacebook

I tried with setLink(null).setDescription, setName, setCaption but none of those worked.

1

1 Answers

5
votes

The short answer is, you can't.

Prefilling the text is against Platform policies (see section 2.3 of https://developers.facebook.com/policy/), and as such, the Android SDK doesn't allow you to do it.