Android examples for android.content.pm:App
is App Running via RunningTaskInfo
import android.app.ActivityManager; import android.content.Context; import java.util.List; public class Main{ public static boolean isAppRunning(Context context, String packageName) { ActivityManager activityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> tasksInfo = activityManager .getRunningTasks(100);//from w w w . j a v a 2 s.c o m for (RunningTaskInfo info : tasksInfo) { if (info.topActivity.getPackageName().equals(packageName) && info.baseActivity.getPackageName().equals( packageName)) { return true; } } return false; } }