Search code examples
androidpid

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


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


Solution

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

    int pid = android.os.Process.myPid();