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 each package a distinct Linux user ID. The identity remains constant for the duration of the package's life on that device."
Is there a way to retrieve this UID?
Use android. os. Process. myUid() to get the calling apps UID directly.
Android. We use the Application ID (package name) to identify your app inside our system. You can find this in the app's Play Store URL after 'id'. For example, in https://play.google.com/store/apps/details?id=com.company.appname the identifier would be com.
If you're referring to this UID: Android is based on Linux, so basically it's the same UID you have on a Unix-like OS. When installing an app / package, Android by default[1] creates a UID specifically for that package, so that it can have its private resources / storage space.
pid = process ID. uid = user ID of the application that owns that process. gid = group IDs of the application that owns that process.
adb shell dumpsys package com.example.myapp | grep userId=
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With