【问题标题】:Send Hangouts chat message(Not SMS message) to specific number through code通过代码向特定号码发送环聊聊天消息(不是短信)
【发布时间】:2014-01-23 22:17:19
【问题描述】:

我用谷歌搜索了这个但找不到答案,有人知道如何通过代码将安卓环聊聊天消息发送到特定号码吗?

【问题讨论】:

    标签: android hangout


    【解决方案1】:

    使用它,您可以打开环聊和信使应用程序。

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("smsto:"));
    
    //Adding message which is to be sent (both are compulsory to compensate for all android versions)
    intent.putExtra(Intent.EXTRA_TEXT, "shareMessage");
    intent.putExtra("sms_body", "shareMessage");
    
    //Addres which is to be sent to (Optional)
    intent.putExtra("address", "12125551212"); //Optional
    startActivity(intent);
    

    【讨论】:

      【解决方案2】:

      嗯,你是说使用环聊应用吗?哪个是作为 SMS 应用程序内置的?

      Intent smsIntent = new Intent(Intent.ACTION_VIEW);
      smsIntent.setType("vnd.android-dir/mms-sms");
      smsIntent.putExtra("address", "12125551212");
      smsIntent.putExtra("sms_body","Body of Message");
      startActivity(smsIntent);
      

      【讨论】:

      • 不,不是短信,而是聊天信息。
      猜你喜欢
      • 1970-01-01
      • 2019-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-29
      • 2013-11-04
      相关资源
      最近更新 更多