通过意图多个电话号码发送短信 [英] Send SMS through intent to multiple phone numbers

查看:122
本文介绍了通过意图多个电话号码发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过发送意向书短信异常自带的 android.content.ActivityNotFoundException:无活动来处理意图行事{= android.intent.action.SENDTO典型值= vnd.android-DI​​R / MMS,SMS(有群众演员)}

When i sending the sms through Intent an exception comes android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO typ=vnd.android-dir/mms-sms (has extras) }

请参阅下面我的code: -

See my code below:-

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和nembers两个电话号码应该是默认的短信box.How的收件人框中显示我该怎​​么办呢?

I want to send the SMS to 2 phone nembers and both the phone numbers should be display in the recipient box of default SMS box.How can i do that?

推荐答案

我得到了我的问题的解决方案。在三星设备我要电话号码有独立的,其他设备接受的';'。所以不幸的是必须做的源$ C ​​$ C之内这个丑陋的特定供应商的决定。

I got the solution of my Question. In SAMSUNG devices i have to separate the phone numbers with ',' while other devices are accept the ';'.So unfortunately have to do this ugly vendor specific decision within your source code.

 String separator = "; ";


 if(android.os.Build.MANUFACTURER.equalsIgnoreCase("Samsung")){
    separator = ", ";
  }

现在我下面code是三星设备的正常工作。

Now my below code is working properly for SAMSUNG devices.

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();
            }

这篇关于通过意图多个电话号码发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆