1. 程式人生 > >Android應用跳轉到微信掃一掃

Android應用跳轉到微信掃一掃

新版的微信APP已經把微信功能的schema都禁掉了,意味著我們無法開啟微信的掃一掃等功能,目前正常的只能先進入微信

public static void toWeChatScan(Context context)

{

try {

Uri uri = Uri.parse("weixin://");

Intent intent = new Intent(Intent.ACTION_VIEW, uri);

context.startActivity(intent);

} catch (Exception e) {

}

}

那麼我們就沒辦法了嗎,當然不會,偶然間看到一個應用竟然直接打開了微信掃一掃,納尼 這是什麼鬼, 反編譯神器

jadx破解,還好沒加固,只是混淆了一下

走你

 public static void toWeChatScanDirect(Context context) {
        try {
            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);
        } catch (Exception e) {
        }
    }

測試了下,完美