当前位置: 代码迷 >> Android >> Android调用系统短信效能发送短信
  详细解决方案

Android调用系统短信效能发送短信

热度:36   发布时间:2016-05-01 10:47:54.0
Android调用系统短信功能发送短信

android调用系统短信功能发送短信有两种方法,

第一种,设定发送的号码,和内容,界面没有联系人,群组组等按钮,如下图所示:

代码如下:

Uri smsToUri = Uri.parse("smsto:114");// 联系人地址			Intent mIntent = new Intent(android.content.Intent.ACTION_SENDTO,					smsToUri);//			EditText et=(EditText) findViewById(R.id.smsContent);			mIntent.putExtra("sms_body", "短信内容");// 短信内容			this.startActivity(mIntent);

?

第二种,设定发送短信内容,不设置发送的号码,界面有联系人,群组等按钮,如下图所示:



?代码如下:

Uri smsUri = Uri.parse("smsto:");			Intent intent = new Intent(Intent.ACTION_VIEW, smsUri);			intent.putExtra("sms_body", "短信内容");			intent.setType("vnd.android-dir/mms-sms");			startActivity(intent);

?

  相关解决方案