开发者

How to get my android app "User" at runtime?

开发者 https://www.devze.com 2023-03-13 20:09 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消