How to open sms app via implicit intent?
Use this:
public void composeSmsMessage(String message, String phoneNumber) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setData(Uri.parse("smsto:"+phoneNumber)); // This ensures only SMS apps respond
intent.putExtra("sms_body", message);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
Official Docmentation
You can try this, it work for me:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_APP_MESSAGING);
startActivity(intent);
Try this:-
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", message);
intent.setData(Uri.parse("sms:"));
startActivity(intent);
} catch (android.content.ActivityNotFoundException anfe) {
Log.d("Error" , "Error");
}
try this:
Intent smsIntent = new Intent(Intent.ACTION_VIEW);
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address", "12125551212");
smsIntent.putExtra("sms_body","Body of Message");
startActivity(smsIntent);