Android Question File.DirDefaultExternal no longer working correctly?

MrKim

Well-Known Member
Licensed User
Longtime User
I was using the following code to determine which directory to use to write files to when copying from a windows network.

B4X:
        If File.ExternalWritable And File.ExternalReadable Then
        SKUtils.GlblNC.LD = File.DirDefaultExternal
Else
      SKUtils.GlblNC.LD = File.DirInternal
End If

I then created a directory:
B4X:
                    If Not(File.exists(SKUtils.GlblNC.LD, "Documents")) Then
 File.MakeDir(SKUtils.GlblNC.LD, "Documents")
End If

I recently upped the target API of an app from 19 to 26 per googles mandate.
And this no longer works. It appears the directory is not created.
Since I upped the target API the code returns File.DirDefaultExternal. I don't know which directory it was returning before.
The line to create the directory fails without error.
Repeatedly running the code always falls in to the MakeDir so I have to assume the directory is not there.

My workaround is to always use file.dirinternal
 
Top