android launch SMS intent without any recipient

2019-02-22 05:55发布

问题:

I want to open the Android SMS application from my application and I don't want to set any contact as a recipient, How?

回答1:

Uri uri = Uri.parse("smsto:");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "Hello World!");  
startActivity(intent);

note

this way doesn't need any permission in Manifest