登录帐号调用即可
跳转到微信,添加公众号
ps:微信把直接跳转到微信公众号的接口已经禁用,所以,我们现在最多只能打开微信了
/**
* 微信公众号
* @param weixin
*/
private void OpenWeiXin(String weixin) {
try {
// 获取剪贴板管理服务
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
//将文本数据(微信号)复制到剪贴板
cm.setText(weixin);
//跳转微信
Intent intent = new Intent(Intent.ACTION_MAIN);
ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(cmp);
startActivity(intent);
Toast.makeText(this, "微信号已复制到粘贴板,请使用", Toast.LENGTH_LONG).show();
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Toast.makeText(this, "您还没有安装微信,请安装后使用", Toast.LENGTH_LONG).show();
}
}