Android Question Runtime Permissions Android 10 / File.DirRootExternal

Arnaud

Active Member
Licensed User
Longtime User
Hello,

With Android 10, it is not possible to read the folder "File.DirRootExternal " because not permission.

( - 29 - No permission to access File.DirRootExternal, even with the STORAGE permission).



Is there an other way to access folder "Download " or "Bluetooth" in Android storage maybe? I need to copy some files received by mail in attachment or via Bluetooth. These file are store automatically in these both folders usually.

Thanks

Arnaud
 

agraham

Expert
Licensed User
Longtime User
I believe that you should be able to use ExternalStorage to access File.DirRootExternal. It will work on the internal storage as well as SD cards and USB sticks. It will require the user to make a one time selection of the that folder.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
29 - No permission to access File.DirRootExternal, even with the STORAGE permission).
I have been able to access File.DirRootExternal Download folder on an Android 10 device and using android:targetSdkVersion="28". You need to request External storage permission, but use 28 instead of 29"
Starter Service:
B4X:
Sub Process_Globals
    Public FilePath As String
    Public rp As RuntimePermissions
End Sub

Sub Service_Create
    FilePath = File.DirRootExternal & "/Download"
    File.MakeDir(FilePath,"")
End Sub

Sub Activity_Create(FirstTime As Boolean)   'in main Activity
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)  '
    Wait For Activity_PermissionResult (Permission As String, PResult As Boolean)
    If PResult = False Then
        MsgboxAsync("No permission to access external storage", "")
        Return
    Else
        File.Copy(File.DirAssets,"france.png",Starter.FilePath, "france.png")
    End If
End Sub
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
I always register my apps e.g. for images. Here the user can share any image with my app (like you do when sharing an image to/with e.g. WhatsApp). Your app then shows up in the list of apps which can handle images.
 
Upvote 0

Arnaud

Active Member
Licensed User
Longtime User
Thanks for your responses.


@Mahares, Unfortunately, it seems that the minimum android:targetSdkVersion=29 is mandatory for Google Play since august 2020. I have try with android:targetSdkVersion=28, my APP was rejected.


I will try with the advice from Erel and KMatle.


thank you very much to all !!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…