1

I am using Intent.ACTION_VIEW to launch New Message composer for the mobile using code given below

Intent smsIntent = new Intent(Intent.ACTION_VIEW);
smsIntent.setData(Uri.parse("smsto:"));
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address"  , numbersString); //delimited phone numbers
smsIntent.putExtra("sms_body"  , Constants.SMS_DEFAULT_MESSAGE); //actual message

startActivity(smsIntent);

This correctly starts activity that launches the New Message composer. However, I want to know whether the User went ahead and actually sent the message, or did he cancel the sending of message.

Jatin
  • 4,023
  • 10
  • 60
  • 107

1 Answers1

0

Did you tried startActivityForResult() ? As per Android Documentation, it is typically used for below purpose:

Launch an activity for which you would like a result when it finished. When this activity exits, your onActivityResult() method will be called with the given requestCode.

That means you need to implement onActivityResult() callback in your Code.

AADProgramming
  • 6,077
  • 11
  • 38
  • 58
  • Unfortunately `startActivityForResult(...)` may not work with all SMS apps. As the OP is simply using an implict `Intent`, the user's default SMS app will be started - if it doesn't return a result then the original `Activity's` `onActivityResult(...)` method won't be called. – Squonk Jan 05 '15 at 04:26
  • @Squonk exactly as evident from this thread https://groups.google.com/forum/#!topic/android-developers/3hjk-g-eaFU – Jatin Jan 05 '15 at 04:37