Android判断前台应用是否是Launcher

    public static boolean isHome(Context context) {
        ActivityManager mActivityManager  =(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
        List rti =   mActivityManager.getRunningTasks(1);
        return rti.get(0).topActivity.getPackageName().equals("com.android.launcher3");
    }

你可能感兴趣的:(framework,android,android,framework)