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 1488人阅读 评论(0) 收藏 举报 android sms string

很多软件都有分享的功能,不少是支持短信分享的,其实就是调用系统发送短信的Activity。代码实现非常简单:

[java] view plain copy
  1. /**
  2. *发送短信
  3. *@paramsmsBody
  4. */
  5. privatevoidsendSMS(StringsmsBody)
  6. {
  7. UrismsToUri=Uri.parse("smsto:");
  8. Intentintent=newIntent(Intent.ACTION_SENDTO,smsToUri);
  9. intent.putExtra("sms_body",smsBody);
  10. startActivity(intent);
  11. }
如果想指定发送人,则修改如下:

[java] view plain copy
  1. /**
  2. *发送短信
  3. *@paramsmsBody
  4. */
  5. privatevoidsendSMS(StringsmsBody)
  6. {
  7. UrismsToUri=Uri.parse("smsto:10000");
  8. Intentintent=newIntent(Intent.ACTION_SENDTO,smsToUri);
  9. intent.putExtra("sms_body",smsBody);
  10. startActivity(intent);
  11. }
看下效果图吧:

更多相关文章

  1. 恢复工厂设置流程
  2. android中判断网络是否连接
  3. Android(安卓)SDK Manager安装过程
  4. android中判断网络是否连接
  5. android 常用资料
  6. Android简单的登录界面的值传递
  7. Android中判断网络是否连接实例详解
  8. android腾讯微博吹一吹实现原理
  9. android中判断网络是否连接

随机推荐

  1. Phonegap软键盘遮挡输入框问题
  2. Android(安卓)Activity的4种启动模式详解
  3. 漫谈Android安全框架
  4. 在Android程序中使用全局变量
  5. 从Android界面开发谈起
  6. Android(安卓)NDK环境搭建
  7. Android热点回顾第一期
  8. HelloWorld-----Google手机操作系统Andro
  9. Android开发者指南(11) ―― Optimizing
  10. Android简介与开发环境搭建