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?
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).
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