调用Android发短信接口Intent.ACTION_SENDTO
public void welcome_register(View v) {
// 测试smsto
Uri sms_uri= Uri.parse("smsto:13517596490");//设置号码
Intent sms_intent = new Intent(Intent.ACTION_SENDTO,sms_uri);//调用发短信Action
sms_intent.putExtra("sms_body", "HelloWorld");//用Intent设置短信内容
startActivity(sms_intent);
// String qqRegiter = this.getString(R.string.QQRegiter);// 获取资源中的字符串
// if (qqRegiter != null && !(qqRegiter.equals(""))) {
// Uri uri = Uri.parse(qqRegiter);// 设置一个统一资源定位符
// Intent intent = new Intent(Intent.ACTION_VIEW, uri);// 展示一个新的View
// startActivity(intent);
// }
}
本文介绍了一个简单的Android应用示例,演示了如何使用Intent.ACTION_SENDTO来发送短信。通过构造特定的URI并附加短信内容,可以启动系统的短信应用并预填短信信息。

892

被折叠的 条评论
为什么被折叠?



