Home > database >  What is the difference between different android permission name prefix?
What is the difference between different android permission name prefix?

Time:10-27

In the android manifest, there are sometimes permissions named as: com.google.android.gms.permission... or android.permission....

Is this naming arbitrary or is there a reason for having different prefixes?

The reason I would like to know this is to be able to locate the right permissions I usually go to the https://developer.android.com/reference/android/Manifest.permission This link contains only ones with "android.permission.*" I would like to know if there is a single reference somewhere for all the other permissions?

P.S. Below is an example of ACTIVITY_RECOGNITION being added to the manifest, trying to make sense of it.

<!-- Required for 28 and below. -->
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<!-- Required for 29 . -->
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

CodePudding user response:

Is this naming arbitrary or is there a reason for having different prefixes?

android.permission is used for permissions in the Android Open Source Project.

com.google.android.gms.permission is used for permissions from what we think of as Play Services.

Other apps can define their own permissions, ideally in their own namespaces. But, they are just strings, so you or I could try defining a custom permission that starts with android.permission.

I would like to know if there is a single reference somewhere for all the other permissions?

Permissions are arbitrary strings from arbitrary developers. There is no way to know what all of them are. I am not aware of Google having documentation listing all of Play Services' permissions, but I cannot rule it out.

Below is an example of ACTIVITY_RECOGNITION being added to the manifest, trying to make sense of it.

This was tied to functionality that originally was supplied by Play Services and then moved into Android itself. So, the permission started with the Play Services namespace and then was cloned into the AOSP namespace.

  • Related