Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtain the Linux UID of an Android App

Tags:

linux

android

uid

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?

like image 579
Erez A. Korn Avatar asked May 25 '11 11:05

Erez A. Korn


People also ask

How do I find my UID on Android?

Use android. os. Process. myUid() to get the calling apps UID directly.

How do I get an app UID?

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.

What is Linux user ID in android?

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.

What is PID and UID in Android?

pid = process ID. uid = user ID of the application that owns that process. gid = group IDs of the application that owns that process.


1 Answers

adb shell dumpsys package com.example.myapp | grep userId=

like image 53
Joe Bowbeer Avatar answered Oct 06 '22 19:10

Joe Bowbeer