Android Facebook SDK shares text without link and image

131 Views Asked by At
 shareDialog = new ShareDialog(this);
 if (ShareDialog.canShow(ShareLinkContent.class)) {
        linkContent = new ShareLinkContent.Builder()
                            .setContentTitle(title)
                            .setContentDescription(description)
                            .build();

         shareDialog.show(linkContent);
 }

I want to post only text content on Facebook wall using Facebook SDK. How can I do it. please help

and I have used this following code

private fun postToFacebook() {

    mFacebook?.dialog(this,"feed" ,object :Facebook.DialogListener{

        override fun onComplete(values: Bundle?) {
          showToast("success")
        }

        override fun onFacebookError(e: FacebookError?) {
            showToast("error")
        }

        override fun onError(e: DialogError?) {
            showToast("error")
        }

        override fun onCancel() {
            showToast("canceled")
        }

    })
}

This shows an error message for me but this code is working for a Youtube video. error getting is herf or media required error

this following link they are doing what i needed i think they using old sdk is in eclips

1

There are 1 best solutions below

3
Abhay Koradiya On

It's limitation of Android SDK due to Platform Policy. You can get more information here (Sharing on Android - Facebook), but in a few words - you cannot share predefined text via Facebook Share Widget:

Use of the Android share sheet is subject to Facebook Platform Policy, including section 2.3 which states that apps may not pre-fill in the context of the share sheet. This means apps may not pre-fill the share sheet's initialText field with content that wasn't entered by the user of the app.