What you learn: You will learn how to read out the PID (ProcessID) of the current Activity using myPid(); and of all Processes using getPids(...,...);.
Difficulty: 0.5 of 5
What it will look like:
[align=center]Nothing to see here...[/align]
Description: This is a 1-liner, not much to explain
Using java Syntax Highlighting
- import android.os.Process;
- // ...
- int myProcessID = Process.myPid();
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
There is a possibility to receive the PIDs of all Processes running on the Android-Device, called getPids(...):
Using java Syntax Highlighting
- // Receive all ProcessIDs running on the device
- int[] pids = Process.getPids("/proc", null);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
Just to see it returns the correct results run a "ps" on the adb shell using the following CommandLine-Code:
- Code: Select all
adb shell ps
Regards,
plusminus





