pmk*_*mko 11
Intent smsIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:5551212;5551212"));
smsIntent.putExtra("sms_body", "sms message goes here");
startActivity(smsIntent);
Run Code Online (Sandbox Code Playgroud)
将以分号分隔的电话号码列表添加到"smsto:"作为Intent构造函数中的URI.
在SAMSUNG设备中你必须用','分隔电话号码,而其他设备接受';'.所以你的代码应该是这样的: -
String separator = "; ";
if(android.os.Build.MANUFACTURER.equalsIgnoreCase("samsung")){
separator = ", ";
}
try {
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("address", "55555"+seperator+"66666");
sendIntent.putExtra("sms_body", "Here is My text");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"SMS faild, please try again later!",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13932 次 |
| 最近记录: |