3

This code was working, it opens the default SMS app and message appears in textbox , ready to enter number and send, But now this code doesn't work from Above marshmallow.

but now It does not work if the default app is Messaging

Uri uri = Uri.parse("smsto:" + mphoneno);
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra("sms_body", message);
mActivity.startActivity(it);
A M
  • 831
  • 1
  • 14
  • 26

1 Answers1

0

try below method to open default messaging app

public void sendSMS()  {  
     String number = "12346556";  // The number on which you want to send SMS  
     startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", number, null)));  
 }  
Rutvik Bhatt
  • 3,185
  • 1
  • 16
  • 28