Post Id facebook share dialog always return null in Android

不羁的心 提交于 2019-12-01 16:45:15

The solution is to force ShareDialog to use Feed mode and avoid using FB's App for sharing:

shareDialog.show(linkContent, ShareDialog.Mode.FEED);

I believe this is a bug by FB. They don't send postId to onSuccess callback when using FB App for sharing (postId = null), but they do if you use Feed.

I've heard you can avoid the "postId=null" problem by using Facebook Login and demanding "publish_actions" permission. But I don't think this is the correct way to deal with this problem. Regarding the mentioned permission Facebook states:

Publishing via dialogs or social plugins does not require this permission. Do not request review of this permission if you're only using Share dialog, Feed Dialog, Message Dialog etc, or Social Plugins (e.g. the Like Button.)

Facebook's docs on Share Dialog:

This does not require Facebook Login or any extended permissions, so it is the easiest way to enable sharing on the web.

You can't login directly with "publish_action", you have to first login with any read permission then ask for for publish permissions https://developers.facebook.com/docs/facebook-login/permissions/v2.4#publishing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!