Vinny K
Vinny K

Reputation: 194

Create SMS message for user and close when they hit send

I'm trying to create an option for a user to select a contact, open up messaging with a pre-populated but editable message. When the user hits send, I'd like for messaging to close and return to my app. Here's my current code to send the SMS:

Intent smsMsg = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:" + phoneNum));
smsMsg.putExtra("sms_body", "Hello friend.");
startActivity(smsMsg);

I tried startActivityForResult hoping the send would get me back yo onActivityResult and it doesn't. What are my options for returning back to my current activity after the user hits send? Or is it even feasible?

Upvotes: 1

Views: 197

Answers (1)

Eikyi
Eikyi

Reputation: 26

This is a duplicate question of Return to Activity after action completed in Android?

just need to add

sendIntent.putExtra("exit_on_sent", true);

Upvotes: 1

Related Questions