Android Intent.SEND与文本和链接信使将无法正常工作

时间:2016-07-01 10:09:19

标签: android facebook facebook-messenger

 Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "SHARE BODY https://www.messenger.com");
        startActivity(Intent.createChooser(sharingIntent, "HUO"));

此文本将正确分享给其他应用,但Messenger只会共享该网址。为什么?我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

  

此文字将正确分享给其他应用

某些应用可能支持此功能。应用不必像您正在做的那样(使用 EXTRA_TEXTEXTRA_STREAM)超出了the ACTION_SEND contract的范围。您应该使用 EXTRA_TEXT EXTRA_STREAM,而不是两者。

  

我该如何解决这个问题?

摆脱EXTRA_TEXT,或摆脱EXTRA_STREAM,或使用现有Intent结构的应用随机获得结果。