Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 通过意向向多个电话号码发送短信_Android_Sms - Fatal编程技术网

Android 通过意向向多个电话号码发送短信

Android 通过意向向多个电话号码发送短信,android,sms,Android,Sms,当我通过Intent发送短信时,出现了一个异常android.content.ActivityNotFoundException:找不到处理Intent的活动{act=android.Intent.action.SENDTO typ=vnd.android-dir/mms-sms(有额外功能)} 请参见下面的我的代码:- try { Intent sendIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("s

当我通过Intent发送短信时,出现了一个异常android.content.ActivityNotFoundException:找不到处理Intent的活动{act=android.Intent.action.SENDTO typ=vnd.android-dir/mms-sms(有额外功能)}

请参见下面的我的代码:-

try {

                 Intent sendIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:5551212;5551212"));
                 sendIntent.putExtra("sms_body", sendSMSStringOnCustomCheckIn()); 
                 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();
            }

我想将短信发送给2个电话号码,并且两个电话号码都应该显示在默认短信框的收件人框中。我如何才能做到这一点?

我得到了问题的答案。在三星设备中,我必须将电话号码与分开,“,而其他设备则接受;”。不幸的是,我们不得不在源代码中做出这一丑陋的特定于供应商的决定

 String separator = "; ";


 if(android.os.Build.MANUFACTURER.equalsIgnoreCase("Samsung")){
    separator = ", ";
  }
现在,我下面的代码在三星设备上正常工作

try {

                 Intent sendIntent = new Intent(Intent.ACTION_VIEW);
                 sendIntent.putExtra("address", "9971227563,9990900909");
                 sendIntent.putExtra("sms_body", sendSMSStringOnCustomCheckIn());
                 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();
            }

没有帮助这个链接,因为它说只添加消息:(为什么不使用sms管理器,因为用户可以根据自己的需要编写文本。这就是为什么我必须打开默认的sms框。为什么你否决它??小米、三星、Nexus 5正在使用
分隔符。