一、调起qq好友的方法:
try {//可以跳转到添加好友,如果qq号是好友了,直接聊天String url = "mqqwpa://im/chat?chat_type=wpa&uin=对方QQ号";//uin是发送过去的qq号码startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));} catch (Exception e) {e.printStackTrace();howToast("请检查是否安装QQ", "");}
二、调起qq群的方法:
key值申请网址:https://qun.qq.com/join.html
/****************
*
* 发起添加群流程。群号:** 的 key 为: AGI****************mS
* 调用 joinQQGroup(AGI****************mS) 即可发起手Q客户端申请加群 **
*
* @param key 由官网生成的key
* @return 返回true表示呼起手Q成功,返回fals表示呼起失败
*
******************/
public boolean 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));// 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)try {startActivity(intent);return true;} catch (Exception e) {// 未安装手Q或安装的版本不支持return false;}
}