当通过未在 Facebook 中显示的意向文本共享时
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, "HELOO WORLD");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share with"));;
最佳答案
根据 Facebook 的说法,这是设计好的。来自 this Facebook developers bug report (需要登录 Facebook 才能查看):
Jesse Chen · · Software Engineer at Facebook
Hi Facebook Developers,This issue is going to be closed by design because our API does not support pre-filling the message for users as seen in our Policy Documentation here (https://developers.facebook.com/docs/guides/policy/application_integration_points/) under Platform Policy IV.2.
August 13, 2012
注意:上面提供的链接已损坏; Facebook 平台政策的当前链接在这里:https://developers.facebook.com/policy/#integration (强调):
IV. Application Integration Points
- [...]
- You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow: Stream stories (user_message parameter for Facebook.streamPublish and FB.Connect.streamPublish, and message parameter for stream.publish), Photos (caption), Videos (description), Notes (title and content), Links (comment), and Jabber/XMPP.
因此 Facebook 应用程序只是强制执行此操作 — 如果您尝试分享带有预填文本的内容,Facebook 不知道它是由用户编写还是由应用程序填写,因此它不会做出任何假设,忽略该文本,并要求用户编写文本。
关于通过 Facebook 中未显示的意向文本进行 Android 分享,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21235272/