Android 如何执行默认短信应用程序?
我注册了我的接收者以获得短信。当我收到短信时,如何执行手机的默认短信应用程序Android 如何执行默认短信应用程序?,android,android-intent,sms,Android,Android Intent,Sms,我注册了我的接收者以获得短信。当我收到短信时,如何执行手机的默认短信应用程序 我可以使用intent send操作启动默认的SMS应用程序吗?可以通过几种不同的方式完成。这里有一个: Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); sendIntent.setType("vnd.android-dir/m
我可以使用intent send操作启动默认的SMS应用程序吗?可以通过几种不同的方式完成。这里有一个:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "Content of the SMS goes here...");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
此处“number”是一个字符串数组,其中包含您要向其发送短信的联系人的号码,“älldetails”是您要发送的字符串。
字符串n=“”;
对于(int i=0;i
Here "number" is an array of strings with the numbers of contacts to whom you want to send sms to and "älldetails" is teh string you want to send.
String n = "";
for(int i = 0; i<sizesf ;i++)
{
if(i == (sizesf-1))
{
n = n + number[i];
}
else
n = n + number[i] + ";";
}
Log.d("numbers in intent", n);
Intent smsIntent = new Intent( Intent.ACTION_VIEW, Uri.parse( "smsto:"+ n) );
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address", n );
smsIntent.putExtra("sms_body",alldetails);
startActivity(smsIntent);