Android Question PermissionsManager

Sergey_New

Well-Known Member
Licensed User
Longtime User
Cannot get permissions when using PermissionsManager. I'm trying:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>
<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)

AddApplicationText(
<provider
android:name="igolub.permissionmanager.b4a.PMFileProvider"
android:authorities="$PACKAGE$.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)

CreateResource(xml, provider_paths,
<files-path name="name" path="shared" />
)

AddPermission(android.permission.DANGEROUS_WRITE_EXTERNAL_STORAGE)
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    Check
End Sub

Sub Check
    Dim PM As PermissionsManager
    PM.CheckAndRequestPermission(PermissionsManager.DANGEROUS_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        Log(Permission)
    End If   
End Sub
Where is my mistake?
 

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
I checked Runtime Permissions again, although I tried it before.
It does not work for me.
 
Upvote 0
Top