Search code examples
androidwhatsappinstant-messagingandroid-sharing

Check if message was succesfully sent via whatsapp


Good Day,

Im building an android app with a function of sharing a text message through whatsapp. Here is my code:

Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SEND);
            intent.putExtra(Intent.EXTRA_TEXT, message.toString());
            intent.setType("text/plain");
            intent.setPackage("com.whatsapp");
            startActivity(Intent.createChooser(intent,""));

The code is working and I can share the message by choosing a contact and pressing send button in whatsapp.

My only problem is I need to go back from my activity and must know whether the message was successfully sent or not.

Any idea?

Thanks in advance.


Solution

  • whether the message was successfully sent or not.

    Answer is No because WhatsApp does not have any api.