Android Question Missing Storage Permission - Permission Request Dialog Does Not Display

biometrics

Active Member
Licensed User
Longtime User
The storage permission is missing from the app permissions.

I ask for permission to access storage in the usual way (see code below) and it works on all phones. We now have a case with a Samsung A71/Android 13 that the request for storage permission dialog doesn't display. We request camera permission after storage permission and that dialog does display.

In the app permission there is no storage option, only camera.

1696414070936.png


B4X:
Sub Process_Globals
    Private libRuntimePermissions As RuntimePermissions
End Sub

Sub Activity_Create(FirstTime As Boolean)
        libRuntimePermissions.CheckAndRequest(libRuntimePermissions.PERMISSION_WRITE_EXTERNAL_STORAGE)
        Wait For Activity_PermissionResult (Permission As String, bResult As Boolean)

End Sub

Manifest targetSdkVersion="33".

Any idea what is going on and how to fix this? The app won't run without storage permission.

Details of the phone:

1696414324663.jpeg
 

DonManfred

Expert
Licensed User
Longtime User
Also check carefullly this thread:

There are more things you need to adapt maybe
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
In 2021 I had to stop using a directory under root and switch to using a directory under GetSafeDirDefaultExternal. It's been working fine so far, and it's still working fine for most of my users. Yet with this new user I can't access files. So I don't understand what has changed and what I need to do. šŸ˜«

B4X:
  sPath = libRuntimePermissions.GetSafeDirDefaultExternal("")
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
This is what the user experiences when closing my app's settings page where I try to save the settings to Settings.txt.

1696418599976.png
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
As of API 30, if you want to read / write any file type from/to external storage, you're supposed to let the user choose first the location of the file. With API 33, some specific permissions were added to allow programmatic access to media files, but nothing else.
Link:
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
As of API 30, if you want to read / write any file type from/to external storage, you're supposed to let the user choose first the location of the file. With API 33, some specific permissions were added to allow programmatic access to media files, but nothing else.
Link:
I read that but that is to access other apps' files. I am only accessing my own files in a directory I got from GetSafeDirDefaultExternal.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I am only accessing my own files in a directory I got from GetSafeDirDefaultExternal.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Looks like GetSafeDirDefaultExternal should still work. Technically the WRITE_EXTERNAL_STORAGE request is not even needed with this method as of KitKat. I did see a code example where the user first checked if the underlying file location is read-only. Are you sure that phone's external storage is writeable?

Link:
Note: The stackoverflow code does check first if the returned file object 1) exits, 2) can be read, and 3) can be written.
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
Ok so seems the user didn't explain the problem properly, I was under the impression that the issue is that they don't have storage permission and the app won't run because of it.

But it was more a case of my permission check being in a loop, but the Android dialog wasn't showing and when there wasn't permission I displayed a MsgBox that they need to allow permission, eventually timing out, displaying a MsgBox that I am sending them to the app permissions to manually enable it, and then sending them to the app permissions page.

I'm now only doing this when it's SDK < 30. It's working with one user so far, so hopefully it sorts of the few others that are now also having this issue.

Will "close" this thread once I get final feedback.
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
In retrospect if

B4X:
        libRuntimePermissions.CheckAndRequest(libRuntimePermissions.PERMISSION_WRITE_EXTERNAL_STORAGE)
        Wait For Activity_PermissionResult (Permission As String, bResult As Boolean)

just returned True on SDK 30+ then this would have worked fine. But now there is no dialog and it returns False.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
just returned True on SDK 30+ then this would have worked fine. But now there is no dialog and it returns False.
Yeah, one has to be careful with that. I'm pretty sure there are some permissions that if the user denies them (on the initial showing of the permission dialog), subsequent permission requests by the app will NOT show a dialog box, but just return false. The user has to explicitly grant requests for that app then in setting or uninstall/re-install the app. (the location request permission might work that way - not 100% sure).
 
Upvote 0
Top