Skip to content Skip to sidebar Skip to footer

Difference Between Mypid & Mytid & Myuid

Difference between :: int pid = android.os.Process.myPid(); android.os.Process.killProcess(pid); //And int pid = android.os.Process.myTid(); android.os.Process.killP

Solution 1:

Only the first one will get the actual process Id and properly kill the process. The other examples will fail because you're passing the wrong process id to killProcess().

From the docs:

myPid() - Returns the identifier of this process, which can be used with killProcess(int) and sendSignal(int, int).

myTid() - Returns the identifier of the calling thread, which be used with setThreadPriority(int, int).

myUid() - Returns the identifier of this process's user.

killProcess(int pid) - Kill the process with the given PID.

See the docs for more details. http://developer.android.com/reference/android/os/Process.html

Here are some additional links:

Post a Comment for "Difference Between Mypid & Mytid & Myuid"