How to get my android app "User" at runtime?
i want to find a process that was inv开发者_如何学编程oked by my application. And when i use "ps pgrep -u" i need my application "User" id.
How can i get it on runtime?
thanks!
See http://developer.android.com/reference/android/os/Process.html.
EDIT: you can also use to http://developer.android.com/reference/android/app/ActivityManager.html#getRunningAppProcesses%28%29 get http://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo.html. You can then find your process in the mix and access your user id.
精彩评论