[英]How can I execute default sms app?
I registered my receiver to get SMS. 我注册了接收者以获得短信。 When I receive SMS's, how can I execute the phone's default SMS app? 收到短信后,如何执行手机的默认短信应用程序?
Can I use the intent send action to start the default SMS app? 我可以使用意图发送操作来启动默认的SMS应用程序吗?
It can be done in a couple of different ways. 可以通过几种不同的方式来完成。 Here's one: 这是一个:
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);
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);
} }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.