Android程序调用QQ的接口方法
- 方式一:引用
- 进入QQ聊天
String url = "mqqwpa://im/chat?chat_type=wpa&uin=" + qq;
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
- 个人介绍界面
String url = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin=" + qq+ "&card_type=person&source=qrcode";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
- QQ公众号
String url="mqq://im/chat?chat_type=crm&uin="+qq;
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
- QQ群介绍界面
String url = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin=" + qqnum+ "&card_type=group&source=qrcode";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
方式二:调用方法
- 封装一个方法
public static void openQQ(Context mContext, int type, String qq) {String url = null;switch (type) {case 1:// 进入QQ聊天 url = "mqqwpa://im/chat?chat_type=wpa&uin=" + qq;break;case 2:// 个人介绍界面 url = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin=" + qq+ "&card_type=person&source=qrcode";break;case 3:// QQ群介绍界面 url = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin=" + qqnum+ "&card_type=group&source=qrcode";break;case 4:// QQ公众号 url="mqq://im/chat?chat_type=crm&uin="+qq; break;default:break;}mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
