Android 发起加入QQ群、打开网址、启动拨打电话界面

QQ群管理地址及获取key
博客提供了QQ群管理地址https://qun.qq.com/join.html ,并提及获取key,但未详细说明获取方式。
   /****************
     *
     * 发起添加群流程。     *
     * @param key 由官网生成的key
     * @return 返回true表示呼起手Q成功,返回fals表示呼起失败
     ******************/
    public static void joinQQGroup(Activity _this, String key)
    {
        Intent intent = new Intent();
        intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key));
        // 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面    
        //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        try
        {
            _this.startActivity(intent);
        } catch (Exception e)
        {
            // 未安装手Q或安装的版本不支持
            ToastUtils.show("未安装手Q或安装的版本不支持");
        }
    }
    
    /**拨打电话 (只打开拨打电话拨号界面,不打电话)
     * @param _this
     * @param phoneNum
     */
    public static void callTel(Activity _this, String phoneNum)
    {
        try
        {
            Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum));
            _this.startActivity(intent);
        }
        catch (Exception e){
            ToastUtils.show("设备不支持拨打电话");
            Log.e("callTel", "callTel: "+e.getMessage() );
        }
    }
    
    /**通过默认浏览器 打开网址
     * @param _this
     * @param url
     */
    public static void openUrl(Activity _this, String url)
    {
        Uri uri = Uri.parse(url);
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        _this.startActivity(intent);
    }

QQ群管理地址:https://qun.qq.com/join.html 获取key

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JackieZhengChina

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值