如果我从我的 Android 设备上卸载一个应用程序并重新安装它,用户 ID 会改变吗?比如用户之前是app-60,重装后会不会又是app-60(uid 60)?
问问题
3508 次
2 回答
0
您可以在应用程序中获取UID
String your app_selected = "your package name";
final PackageManager pm = getPackageManager();
//get a list of installed apps.
List<ApplicationInfo> packages = pm.getInstalledApplications(
PackageManager.GET_META_DATA);
int UID;
//loop through the list of installed packages and see if the selected
//app is in the list
for (ApplicationInfo packageInfo : packages) {
if(packageInfo.packageName.equals(app_selected)){
//get the UID for the selected app
UID = packageInfo.uid;
}
}
于 2013-01-22T07:27:59.153 回答