I just come to know newer tag in android manifest file called \"uses-permission-sdk-23\"
Specifies that an app wants a particular permission, but only if the app is running on a device with API level 23 or higher. If the device is running API level 22 or lower, the app does not have the specified permission.
user-permission-sdk-23 specifies that the app that wants a particular permission is running on SDK version 23 or higher. It is used when you update your app to run SDK 23 elements and the users running a lower API which does not support the new elements.
Android manifest - user permissions
if the app is running on a device with SDK version 23 or higher. If the device is running SDK version 22 or lower
when you update an app to include a new feature that requires an additional permission. If a user updates an app on a device that is running SDK version 22 or lower, the system prompts the user at install time to grant all new permissions that are declared in that update. If a new feature is minor enough, you may prefer to disable the feature altogether on those devices, so the user does not have to grant additional permissions to update the app. By using the uses-permission-sdk-23 element instead of uses-permission
you can request the permission only if the app is running on platforms that support the runtime permissions model, in which the user grants permissions to the app while it is running.
for More info refer this.uses - Permission sdk 23
see the documentation uses permission
Use
<uses-permission-sdk23>
to apply permission for Marshmallow devices only.
<uses-permission>
applies to all SDKs and <uses-permission-sdk-23>
will apply the permission only to SDK 23+.
<uses-permission-sdk-23>
?For Android SDK 23 and above, you have the option to request the permission at runtime but the permissions will be in their default state upon installation and the user will not be prompted at installation. (Essentially this can be used to prompt the user to grant the permission on a need-to-use basis and you have the opportunity to provide an explanation of why it's needed.)
However, for SDK 22 and below, the user is prompted at installation for permissions. As some permissions can seem suspicious or dodgy to the user, you may not want to request these for SDK 22 and below as you can't provide an explaination of why you need them beforehand, hence the <uses-permission-sdk-23>
tag.
Additionally: the documentation is unclear as to whether sdk-23
permissions also cause the app to be filtered in the Play Store, but if it was your intention to do this, the documentation recommends that you make use of <uses-feature>
elements instead to declare hardware compatability.
Generally, it is considered best practice to use <uses-permission-sdk-23>
if your app does not need to support SDK 22 and below, or if the permission you are requesting is not needed for SDK 22 or below as it is then clear that this permission is requested at runtime.
Otherwise, <uses-permission>
should be used as this is backwards compatible and the behavior will be correct on any SDK version; 22 and below, permissions will be requested at installation. 23 and above, it's up to you to request at runtime.
You should request permissions at runtime wherever possible as it allows you to explain to your user why you need certain permissions rather than just prompting them with a list of permissions at install time when the user has likely not established trust in the app.
Both of these accept a maxSdkVersion
attribute that can be used when a permission was required for older devices but is not required for newer devices. (For example, the WRITE_EXTERNAL_STORAGE
example shown in the Android documentation.)
Reference: (Android Documentation)
By using the <uses-permission-sdk-23>
element instead of <uses-permission>
, you can request the permission only if the app is running on platforms that support the runtime permissions model, in which the user grants permissions to the app while it is running.
This has been introduced to support runtime permission feature of Marshmallow (API-23) onwards.
This simply specifies that an app wants a particular permission, but only if the app is running on a device with SDK version 23 or higher. If the device is running SDK version 22 or lower, the app does not have the specified permission. This element is useful when you update an app to include a new feature that requires an additional permission. If a user updates an app on a device that is running SDK version 22 or lower, the system prompts the user at install time to grant all new permissions that are declared in that update.
You can reffer to the documentation.