How can I check the state (pause/running/suspended) of a particular process running on the Android device programmatically? I want to include this logic within my application.
Using ActivityManager, I am able to retrieve a list of all processes running on the device, but it doesn't show me any process state information. Any idea on how I can retrieve this information?
Thanks in Advance.
I was wrong when I mentioned in the question that there is no process state information in the list of processes retrived using ActivityManager.
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> list2= am.getRunningAppProcesses();
for (RunningAppProcessInfo ti : list2) {
Log.i("IMPORTANCE CODE",String.valueOf(ti.importance));
}
ti.importance retrives a constant value which describes whether the process is running FOREGROUND, BACKGROUND, Empty of code etc...
More information can be found at the following location:
http://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo.html
Thanks, Navin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With