How to share text to WhatsApp from my app?

前端 未结 9 1174
醉话见心
醉话见心 2020-12-04 12:27

I develop an app with a functionality for sharing text. This is working fine except for WhatsApp. What should I do? Is there any specific API for that?

相关标签:
9条回答
  • 2020-12-04 12:55
      Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
        sendIntent.setType("text/plain");
    sendIntent.setPackage("com.whatsapp");
        startActivity(sendIntent);
    
    0 讨论(0)
  • 2020-12-04 12:56

    You can use the WhatsApp API Android: http://www.whatsapp.com/faq/en/android/28000012 iOS: http://www.whatsapp.com/faq/en/iphone/23559013

    0 讨论(0)
  • 2020-12-04 12:57
    Intent share = new Intent(Intent.ACTION_SEND);
        share.setType("text/plain");
        share.putExtra(Intent.EXTRA_TEXT, "Your text");
        startActivity(Intent.createChooser(share, "Share using"));
    
    0 讨论(0)
提交回复
热议问题