Android调用系统发送短信界面
16lz
2021-12-04
android 调用系统 发送短信 和 已发送短信界面
1. 调用系统发送短信界面(并指定短信接收人和短信内容)
Uri smsToUri = Uri.parse("smsto:10086");
Intent mIntent = new Intent( android.content.Intent.ACTION_SENDTO, smsToUri );
mIntent.putExtra("sms_body", "The SMS text");
startActivity( mIntent );
2. 调用系统已发送短信界面
Uri smsUri = Uri.parse("smsto:106900867734");
Intent intent = new Intent(Intent.ACTION_MAIN, smsUri)
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
这里我们使用action_main 根据api显示提示
android.content..ACTION_MAIN = "android.intent.action.MAIN"
public static finalACTION_MAINSince:
Activity Action: Start as a main entry point, does not expect to receive data.
Input: nothing
Output: nothing
Constant Value:"android.intent.action.MAIN"
Android调用系统发送短信界面
分类:Android 2012-08-19 12:48 1488人阅读 评论(0) 收藏 举报 android sms string很多软件都有分享的功能,不少是支持短信分享的,其实就是调用系统发送短信的Activity。代码实现非常简单:
[java] view plain copy
- /**
- *发送短信
- *@paramsmsBody
- */
- privatevoidsendSMS(StringsmsBody)
- {
- UrismsToUri=Uri.parse("smsto:");
- Intentintent=newIntent(Intent.ACTION_SENDTO,smsToUri);
- intent.putExtra("sms_body",smsBody);
- startActivity(intent);
- }
[java] view plain copy
- /**
- *发送短信
- *@paramsmsBody
- */
- privatevoidsendSMS(StringsmsBody)
- {
- UrismsToUri=Uri.parse("smsto:10000");
- Intentintent=newIntent(Intent.ACTION_SENDTO,smsToUri);
- intent.putExtra("sms_body",smsBody);
- startActivity(intent);
- }
更多相关文章
- 恢复工厂设置流程
- android中判断网络是否连接
- Android(安卓)SDK Manager安装过程
- android中判断网络是否连接
- android 常用资料
- Android简单的登录界面的值传递
- Android中判断网络是否连接实例详解
- android腾讯微博吹一吹实现原理
- android中判断网络是否连接