Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get pid of android application without using adb shell?

Tags:

android

pid

How can I get an android application pid without using adb shell? Is there any API to get pid. any help will be appreciated

like image 978
RanjitRock Avatar asked Sep 17 '11 12:09

RanjitRock


People also ask

What is PID Android?

pid = process ID. uid = user ID of the application that owns that process. gid = group IDs of the application that owns that process.


1 Answers

As every application has its own process id, one can get it by

int pid = android.os.Process.myPid(); 
like image 165
Mohammed Azharuddin Shaikh Avatar answered Sep 17 '22 18:09

Mohammed Azharuddin Shaikh