通过 Facebook 中未显示的意向文本进行 Android 分享

标签 android android-intent

当通过未在 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

  1. [...]
  2. 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/

相关文章:

android - 如何取消使用 startActivityForResult 开始的 Activity

Android广播接收器不工作

android - 在android中播放音频文件

android - 将 FFMPEG AvFrame 数据从 C++ 传递到 JAVA

java - 在 Android 上使用 OpenCV 提高 Tesseract 性能

android - Java 编译器错误 : can't find (SINGLE_CHOICE_MODE);

android - 使用 smack 重新连接到 xmpp 服务器

java - 根据列表项的位置替换 fragment

android - 在两个 Activity 之间传递 bool Intent

android - 如何在不使用 try/catch 在 android 中处理它的情况下获得 401 响应