Just a confirmation if I'm doing correctly:
I have declared in "configure paths" the android-23 platform. This because I want to manage a runtime permission in Android 6 and force the user to exclude the App from the battery optimization
I thought first that I had also to declare in the manifest the android:targetSdkVersion="23"
And then I discovered I had to manage in runtime all the other dangerous permission, like write to external storage.
The question is: can I have the android-23 platform in "configure paths" and specify android:targetSdkVersion="22" (not 23) in the manifest ?
This way I can use just the runtimepermission I need, without need to modify much other code.
It seems to work, just need confirmation.
I have declared in "configure paths" the android-23 platform. This because I want to manage a runtime permission in Android 6 and force the user to exclude the App from the battery optimization
B4X:
Sub Activity_Resume
If GetAndroidApiLevel>=23 Then
Dim JavaObject1 As JavaObject
JavaObject1.InitializeContext
Dim Ignoring As Boolean=JavaObject1.RunMethod("isIgnoringBatteryOptimizations", Null)
If Ignoring=False Then
Msgbox("it is mandatory to answer YES to the following box to exclude this App from battery optimization.", "Battery optimization")
RuntimePermissions1.CheckAndRequest("android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS")
End If
End If
I thought first that I had also to declare in the manifest the android:targetSdkVersion="23"
And then I discovered I had to manage in runtime all the other dangerous permission, like write to external storage.
The question is: can I have the android-23 platform in "configure paths" and specify android:targetSdkVersion="22" (not 23) in the manifest ?
This way I can use just the runtimepermission I need, without need to modify much other code.
It seems to work, just need confirmation.