android后台service查看当前正在运行的应用的包名
ActivityManager activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);ListtaskInfo = activityManager.getRunningTasks(1);ComponentName componentInfo = taskInfo.get(0).topActivity;Log.d(tag, "当前应用:" + componentInfo.getPackageName());
记录一下