Android跳转到QQ加群、聊天页面

1.跳转到QQ聊天页面(单聊)

try {
   String url = "mqqwpa://im/chat?chat_type=wpa&uin=453453446";
    //uin是发送过去的qq号码 
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
 } catch (Exception e) {
    e.printStackTrace();
    ToastUtils.show(this, "您还没有安装QQ,请先安装软件");
}

2.跳转到QQ群页面
    在跳转到QQ群页面前,需要先获取要跳转到QQ群的Key,获取Key的网址:https://qun.qq.com/join.html

 public void joinQQGroup(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));
        try {
            startActivity(intent);
        } catch (Exception e) {
            ToastUtils.show(this, "您还没有安装QQ,请先安装软件");
        }
    }

你可能感兴趣的:(Android跳转到QQ加群、聊天页面)