调用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接口实现发送短信的功能。通过创建Intent并指定ACTION_SENDTO动作及短信接收者的电话号码,可以启动系统默认的短信应用,并预填短信内容。
890

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



