How to specify SMS intent recipient

Put your problem here if it does not fit any of the other categories.

How to specify SMS intent recipient

Postby PaulFake » Sun Oct 11, 2009 11:05 am

Hello,

I am launching an SMS activity, but I don't know how to specify the recipient so that the number will appear in the "To" field. I was hoping something like the following would work, but it doesn't.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Intent sendIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:8675309"));
  3.  
  4. sendIntent.putExtra("sms_body", "");
  5.  
  6. sendIntent.setType("vnd.android-dir/mms-sms");
  7.  
  8. startActivity(sendIntent);
  9.  
  10.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
PaulFake
Junior Developer
Junior Developer
 
Posts: 21
Joined: Wed Aug 26, 2009 1:05 am

Top

Postby PaulFake » Sun Oct 11, 2009 11:16 am

No sooner do I post than I solve my own problem:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Intent sendIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("smsto:5555555"));
  3.  
  4. sendIntent.putExtra("sms_body", "");
  5.  
  6. sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
  7.  
  8. startActivity(sendIntent);
  9.  
  10.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


It's a combination of using "smsto" and ComposeMessageActivity.
PaulFake
Junior Developer
Junior Developer
 
Posts: 21
Joined: Wed Aug 26, 2009 1:05 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 15 guests