When using RuntimePermissions, permission cannot be obtained:
Tested on a Samsung Galaxy S23 FE with Android 14 and on an emulator with Android 13.
Result = False
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddManifestText(
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29" />
)
B4X:
Sub Process_Globals
Private xui As XUI
Private rp As RuntimePermissions
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Check
End Sub
Sub Check
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
Log(Permission)
End If
End Sub
Result = False