Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the system recognize which app is sending the request?

In android, every app has certain permissions for resources it can access. How does the system determine which app is sending the request and check whether it has the appropriate permissions?

e.g.: app calls getLocation() which gets GPS location from the system how does the system know which app has called this and how does it check the app permissions?

like image 914
coolharsh55 Avatar asked Jan 26 '26 00:01

coolharsh55


1 Answers

There is a Linux identity (aka userID) associated with each app. Android assigns this userID to the app at install time. This userID stays the same during the lifetime of the app on that particular device. Additionally, each package runs in its own process, so when a call (like getLocation()) is made by the app Android knows the process that performed the call and who is the Linux user (i.e. the app) that owns the process.

You should also check PackageManager, which is an API over these kind of capabilities (otherwise specific to the OS).

like image 195
cobarzan Avatar answered Jan 27 '26 12:01

cobarzan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!