CommonMan
CommonMan

Reputation: 3928

Marshmallow permission model

I have a question about Marshmallow permission model. If My app is targeting API level 22 and user installs my app on Marshmallow. Do I get all permission pre granted?

I did not see this in any of the document.

Thanks in Advance.

Upvotes: 2

Views: 210

Answers (3)

GomathiSelvakumar
GomathiSelvakumar

Reputation: 494

If the device is running Android 6.0 (API level 23) or higher, and the app's targetSdkVersion is 23 or higher, the app requests permissions from the user at run-time. The user can revoke the permissions at any time, so the app needs to check whether it has the permissions every time it runs. For more information about requesting permissions in your app,See this link

https://developer.android.com/guide/topics/security/permissions.html

Upvotes: 0

Nilabja
Nilabja

Reputation: 4276

yes you should get all the dangerous permissions pre-granted, but a user can revoke them anytime that may cause instability in the application.

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1006674

I did not see this in any of the document.

Quoting the documentation:

If the device is running Android 5.1 (API level 22) or lower, or the app's targetSdkVersion is 22 or lower, the system asks the user to grant the permissions when the user installs the app. If you add a new permission to an updated version of the app, the system asks the user to grant that permission when the user updates the app. Once the user installs the app, the only way they can revoke the permission is by uninstalling the app.

Yes, you get all the permissions at install time. However, the user can still revoke those permissions manually through Settings, and if the user does, while you (generally) will not get a SecurityException, you will not get the protected data. For example, if the user revokes your access to contacts, and you try querying for contacts, the system will behave as if there are no contacts.

Upvotes: 3

Related Questions