Android examples for android.app:ActivityManager
is App Alive
import android.app.ActivityManager; import android.content.Context; import android.util.Log; import java.util.List; public class Main{ public static boolean isAppAlive(Context context, String packageName) { ActivityManager activityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> processInfos = activityManager .getRunningAppProcesses(); for (int i = 0; i < processInfos.size(); i++) { if (processInfos.get(i).processName.equals(packageName)) { return true; }/*from ww w . j av a 2 s . c o m*/ } return false; } }