Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 785 Bytes

maxsdkversion.md

File metadata and controls

26 lines (19 loc) · 785 Bytes

maxSdkVersion

<uses-permission> has an attribute call maxSdkVersion. PermissionsDispatcher support the feature as well.

The following sample is for declaring Manifest.permisison.WRITE_EXTERNAL_STORAGE up to API level 18.

0. AndroidManifest

Declare the permission with maxSdkVersion attribute

<uses-permission
     android:name="android.permission.WRITE_EXTERNAL_STORAGE"
     android:maxSdkVersion="18" />

1. Attach annotations with maxSdkVersion

@RuntimePermissions
public class MainActivity extends AppCompatActivity {
    @NeedsPermission(value = Manifest.permission.WRITE_EXTERNAL_STORAGE, maxSdkVersion = 18)
    void getStorage() {
    }
}