Obtain the Linux UID of an Android App

前端 未结 6 2152
半阙折子戏
半阙折子戏 2020-12-23 12:23

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

Excerpt from Security and Permissions: \"At install time, Android gives e

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 12:49

    PackageManager packageManager = getPackageManager();
    try {
        applicationId = String.valueOf(packageManager.getApplicationInfo("com.example.app", PackageManager.GET_META_DATA));
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
    

提交回复
热议问题