【问题标题】:How to show the dialog of all the messaging options in android?如何在android中显示所有消息选项的对话框?
【发布时间】:2013-04-26 16:28:05
【问题描述】:

我正在尝试使用SmsManager 向手机上的选定联系人发送文本messages,但默认情况下它使用手机GSM 消息选项发送消息。我的要求是向用户显示弹出窗口以选择消息选项,例如WHATSAPPVIBER 等,如图所示

这是我的代码

SmsManager sm = SmsManager.getDefault();
sm.sendTextMessage("9844598445", null, "Hello There", null, null);

请帮忙

【问题讨论】:

    标签: android sms android-contacts whatsapp


    【解决方案1】:

    试试这个

    Uri uri = Uri.parse("smsto:" + smsNumber);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", smsText);  
    startActivity(intent);
    

    【讨论】:

      【解决方案2】:

      您现在正在做的是直接通过 SDK 发送短信。如果您想为用户提供通过另一个已安装的应用程序发送它的选项,您需要使用 Intent:

      Uri uri = Uri.parse("smsto:1234567890");   
      Intent it = new Intent(Intent.ACTION_SENDTO, uri);   
      it.putExtra("sms_body", "The SMS text");   
      startActivity(it);  
      

      【讨论】:

        猜你喜欢
        • 2017-08-01
        • 1970-01-01
        • 2019-09-12
        • 1970-01-01
        • 2017-02-18
        • 1970-01-01
        • 2016-01-08
        • 2016-09-12
        • 1970-01-01
        相关资源
        最近更新 更多