-1

I know I can open an external program like Spotify with a link, but I'm wondering if it's possible to open the native text message app with a pre-populated the message the same way that the native share sheet does.

For example, this will open spotify:
<a href='spotify:track:7GhIk7Il098yCjg4BQjzvb'>Test link</a>

Seamus James
  • 981
  • 3
  • 12
  • 25
  • you want to open default sms app? – Elias Fazel Mar 28 '17 at 23:10
  • Yes. For example, if you're using the Reddit app on iOS and you click share, it opens the native 'share sheet.' One of those options is "Message" and when you click it, it takes you to a new text message screen where the text is pre-populated with whatever you're sharing and a URL. I'm wondering if I can initiate that behavior with a link in browser. Not sure why I'm getting downvoted. – Seamus James Mar 29 '17 at 00:56

1 Answers1

1

invoke intent for SMS app

Intent smsIntent = new Intent(android.content.Intent.ACTION_VIEW);
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address", phoneNumber);
smsIntent.putExtra("sms_body", text);
context.startActivity(Intent.createChooser(smsIntent, "SMS:"));

also you can check this answer for more options.

Community
  • 1
  • 1
Elias Fazel
  • 2,093
  • 16
  • 20