安卓通过Intent一键打开微信扫一扫

2018-08-13  本文已影响75人  ysnows
  1. 第一种方式:直接打开扫一扫页面

            Intent intent = new Intent();
            intent.setComponent(new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI"));
            intent.putExtra("LauncherUI.From.Scaner.Shortcut", true);
            intent.setFlags(335544320);
            intent.setAction("android.intent.action.VIEW");
            context.startActivity(intent);
        
    
  2. 第二种方式:先打开微信然后跳入到二维码扫描页面

            Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.tencent.mm");
            intent.putExtra("LauncherUI.From.Scaner.Shortcut", true);
            context.startActivity(intent);```
    
    
欢迎关注我的个人公众号(捯饬捯饬啥)
daochidaochisha
上一篇 下一篇

猜你喜欢

热点阅读