1.判断是否属于Launcher apk
private boolean isShowLauncher() {
ActivityManager activityManager = (ActivityManager) this
.getSystemService(Context.ACTIVITY_SERVICE);List<RunningTaskInfo> list = activityManager.getRunningTasks(2);
if (list == null || list.size() <= 0) {
return false;
}
if (list.get(0).topActivity.getPackageName().equals(
"com.android.mslauncher")) {
return true;
}
return false;
}
2.如何判断某个apk中的某个activ