2.2.0
maxSdkVersion
Define permission with maxSdkVersion
attribute as the following in your manifest.
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
And define corresponding method. In this case generated method(showGetStorageWithCheck
) doesn't check the permission if device api level is more than 18.
@NeedsPermission(value = Manifest.permission.WRITE_EXTERNAL_STORAGE, maxSdkVersion = 18)
void showGetStorage() {
// use permission
}
See more detail in Android developers.