Search code examples
androidandroid-intentonactivityresult

How to check sent text in OnActivityResult?


I need to be able to check if the user has sent the text I set in my code;

Intent messageIntent = new Intent(Intent.ACTION_SEND)

messageIntent.putExtra(Intent.EXTRA_TEXT, "Text I want to send");

or has changed the prefixed text (on the SMS client app, email client app, or the app that gets launched by the intent) before sending it.

I need to know this because sharing my game link will give a reward to the user, so I need to check if that link is correctly shared.

I would appreciate any answer that could help.

Thanks.


Solution

  • ACTION_SEND isn't documented to return a result. So starting the intent with startActivityForResult() will return the default result: RESULT_CANCELED. That is, unless the receiving app has implemented support for returning a result; which is highly unlikely because it's not part of the documented behavior.

    In summary, what you want to do is not possible with any of the common Intents.