Skip to content Skip to sidebar Skip to footer

Require Permission Only For Older Android Versions: Maxsdkversion Does Not Work?

I want to some permissions only for older devices for compatibility. So I did some research and found this here: android:maxSdkVersion The highest API level at which this per

Solution 1:

maxSdkVersion attribute was added in API level 19 (docs should have mentioned that). Ref.:

Introduce maxSdkVersion for <uses-permission>

This way an application can automatically sunset its permission requests when running on later versions of the OS where those permissions are no longer relevant, but may be alarming to the user. A canonical example is WRITE_EXTERNAL_STORAGE, which as of KLP becomes unnecessary for an app to use the external storage volume solely for its own large-data needs, without the need for actual file-system sharing among multiple apps.

Bug 9761041

Change-Id: I60130af3a108fe4a750c356038a1c8cb897e9c8b(missing, can be a Google internal change)

Looks like Android 4.4 was still not named as KK at that time :)

Solution 2:

On my HTC with Android 5.0.2 external storaged failed when having the permissions and restrictions: android.permission.WRITE_EXTERNAL_STORAGE and maxSdkVersion = 18. So I needed to change maxSdkVersion to 22.

Post a Comment for "Require Permission Only For Older Android Versions: Maxsdkversion Does Not Work?"