通过Android Intent共享Unicode文本在Whatsapp

时间:2016-08-25 09:30:14

标签: android android-intent whatsapp

我通过Intent从我的应用程序共享一个unicode文本,以便用户可以选择通过电子邮件,Whatsapp或任何其他接收文本/普通的应用程序共享文本。

当文字大小很大(1000字符或更多)时,Whatsapp收到的文字被截断,但是在电子邮件和其他应用上收到全文。

我分享如下,并且尝试过Intent而不是ShareCompact,但两者的作用相似!

    StringBuilder sb = new StringBuilder()
            .append(service.getTite())
            .append(service.getTextBody())
            .append(service.getTranslations());

    ShareCompat.IntentBuilder.from(this)
            .setType("text/plain")
            .setText(sb.toString())
            .setSubject(service.getTite())
            .setChooserTitle(R.string.share_prompt)
            .startChooser();

是否有与Whatsapp共享文本的最大限制或某些已知的解决方案如何通过Intent共享向Whatsapp分享1-2K unicode数据。

1 个答案:

答案 0 :(得分:1)

试试这个

Uri uriUrl = Uri.parse("whatsapp://send?text="+text+""); 
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);  
startActivity(launchBrowser);