android app 跳转到微信

公司做了个微信投票活动,必须下载安装我们的app才能参加 ,所以当新客户投票时就会下载安装我们的,然后在注册完成后客户信息同步到微信接口上 ,然后就有一个回到微信的跳转。主要代码如下:try catch  捕捉到ActivityNotFoundException  异常说明手机没有安装微信。

try {

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);
} catch (ActivityNotFoundException e) {
// TODO: handle exception
Toast.makeText(context, "检查到您手机没有安装微信,请安装后使用该功能", Toast.LENGTH_LONG).show();

你可能感兴趣的:(android,遇到的问题,app跳转到微信,android,微信)