Android Question MakeDir not working on Android 10

Melghost

Member
Licensed User
Longtime User
Hi.

I've recently updated my phone and my version of B4A to 10.70.

Unfortunately there are some things that have stopped working but they always worked fine for me before. I don't know what I'm doing wrong.

The code is simple:

B4X: Copy
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    
    File.MakeDir(File.DirRootExternal, "Melghost/Prueba")
    
End Sub

This code will run without apparent errors, but no folder will be created.

This is what appears on the Manifest Editor window:

B4X: Copy
AddManifestText(
<uses-sdk android:minSdkVersion="14" 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)


Maybe I'm losing some "how to"s on newer Android versions?

Thank you.


Phone: UniHertz Jelly2
Android version: 10
 
This might help:

Note line #2:
B4X: Copy
2.This class can also be used to access the secondary storage (File.DirRootExternal). This becomes relevant with newer versions of Android that restrict direct access.
 
Upvote 0
This might help:
That is of much less use under Android 11 than it was as it is now has restricted access.
Android 11 storage FAQ. First introduced in Android 10, scoped… | by nandana | Android Developers | Medium
Storage Access Framework (SAF) is indeed one option that allows the user to grant access to directories and files. However, note that there are access restrictions to certain directories, such as the root and Android/data directories.
I am already/will be using this for my own apps but you can't use it if you want your apps in the Play Store.
Manage External Storage - access internal external storage >= SDK 30 | B4X Programming Forum
 
Upvote 0
Back
Top