【发布时间】:2013-08-22 07:54:16
【问题描述】:
我正在尝试通过 Android 中的客户端共享一些信息。 此代码在 Gmail、Evernote、Twitter、Viber、Whatsapp 等中运行良好,但在 Facebook 中无法运行,因为它们不支持 EXTRA_TEXT 字段(aaargh!)。
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test message");
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(sharingIntent,"Share using"));
所以我想到了一种可能的解决方案。当用户单击共享按钮时,我会创建一个新对话框,用于在 Facebook 和其他人上共享。使用 Facebook SDK,我可以在 Facebook 上共享文本、图像等。当用户点击“其他”时,除了没有 facebook 应用之外,所有客户端都应显示正常的共享意图。
这可能吗?您还有其他想法来完成这项工作吗?
【问题讨论】:
标签: android facebook android-intent