android 调用第三方QQ、微信、新浪微博、腾讯微博等聊天方法

来源:互联网 发布:网络病毒处置演练脚本 编辑:程序博客网 时间:2024/05/16 05:41

1.打开微信

try {
Intent intent = new Intent();
ComponentName cmp = new ComponentName("com.tencent.mm","com.tencent.mm.ui.LauncherUI");
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(cmp);
startActivityForResult(intent, 0);
} catch (Exception e) {
Toast.makeText(context, "您的手机未安装微信!", Toast.LENGTH_SHORT).show();
}

PS:

新浪微博:com.sina.weibo             com.sina.weibo.EditActivity

腾讯微博:com.tencent.WBlog      com.tencent.WBlog.activity.MicroblogInput

腾讯QQ:com.tencent.mobileqq    com.tencent.mobileqq.activity.HomeActivity

2.调用QQ聊天

String qq="734473685";这里写要调用的QQ号

String url="mqqwpa://im/chat?chat_type=wpa&uin="+qq;

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));   



0 0
原创粉丝点击