Search code examples
androidandroid-intentandroid-6.0-marshmallowsmsmanager

Couldn't send SMS from Activity , says "could not start conversation"


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);

Solution

  • 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)));  
     }