Ask all permissions during app installation on API > 23

Viewed 6786

Since android M the only way to ask permissions is to do so ant runtime but VK client app somehow manages to ask all of its permissions upon installation on all android versions. Below is a screenshot from pixel phone. Can anyone tell me how is it even possible?

enter image description here

3 Answers

They use targetSdkVersion lower than 23:

"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 [...] If the device is running Android 5.1.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"

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

It just seems the app was not updated to comply with API level >= 23. You can manage differently asking permissions depending on the API level targeted.

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 accesses permission-protected APIs. For more information about requesting permissions in your app, see the Working with System Permissions training guide.

If the device is running Android 5.1.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.

Requesting Permissions API Guide

The permissions are classified as : Normal permissions or dangerous permissions

-Normal permissions : don't pose much risk to the user's privacy or the device's operation. if your app lists normal permissions in its manifest the system automatically grants those permissions to your app at install time(the system does not prompt the user to grant normal permissions , and user can't revoke them).

-dangerous permissions : these permissions could potentially affect the user's privacy or the device's normal operation , the user must explicity agree to grant those permissions. Only dangerous permissions require user agreement. But the way Android asks the user to grant dangerous permissions depends on 2 things :

1)Version of android running on the user device 2)The system version targeted by the app (targetSdkVersion)

  • if the device is running Android 6.0(API level 23) or higher , and the app 'targetSdkVersion' is 23 or higher, the user will not be notifiy of any app permissions at install time, your app must ask the user to grant the dangerous permissions at runtime (see the documentation for how to request permissions and check it).
  • if the device is running Android 5.1.1 (API level 22) or lower , or the app 'targetSdkVersion' is 22 or lower , the system automatically asks the user to grant all dangerous permissions for your app at install time
Related