获取Linux的UID一个Android应用程序的应用程序、Linux、UID、Android

2023-09-05 03:49:08 作者:帅得惨不忍睹

我希望能够得到一个安装的Andr​​oid应用程序的Linux的UID(用户ID)。

I would like to be able to get the Linux UID (user ID) of an installed Android application.

从安全和权限:在安装的时候,Android给每个包一个独特的Linux的用户ID。该身份保持恒定在该设备上的程序包的寿命的持续时间。

Excerpt from Security and Permissions: "At install time, Android gives each package a distinct Linux user ID. The identity remains constant for the duration of the package's life on that device."

有没有一种方法来检索这个UID?

Is there a way to retrieve this UID?

推荐答案

使用 PackageManager getApplicationInfo()