Hi All,
Trying to sort out RunTime Permissions as per the tutorial and getting tripped up by replacing "File.DirRootExternal" with "rp.GetAllSafeDirsExternal("")" for older devices.
Below is the code that is causing the problem.
I need to translate:
File.Exists(File.DirRootExternal&"/ABT/", "") Etc.
to something like this:
File.Exists(rp.GetAllSafeDirsExternal("/ABT/"),"") Etc.
As it is it generates a number of warnings and of course does not compile.
If some kind person can spot what I have done wrong please point me in the right direction.
Regards Roger
[My other solution is to set the SDKMin to 21. [Android version 5+]
Trying to sort out RunTime Permissions as per the tutorial and getting tripped up by replacing "File.DirRootExternal" with "rp.GetAllSafeDirsExternal("")" for older devices.
Below is the code that is causing the problem.
I need to translate:
File.Exists(File.DirRootExternal&"/ABT/", "") Etc.
to something like this:
File.Exists(rp.GetAllSafeDirsExternal("/ABT/"),"") Etc.
As it is it generates a number of warnings and of course does not compile.
If some kind person can spot what I have done wrong please point me in the right direction.
Regards Roger
[My other solution is to set the SDKMin to 21. [Android version 5+]
B4X:
'*** Checks for Permission to read/write external memory and creates directory to save files. ***
If rp.Check("android.permission.WRITE_EXTERNAL_STORAGE") = False Then
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = "android.permission.WRITE_EXTERNAL_STORAGE" And Result = True Then
'If File.Exists(File.DirRootExternal&"/ABT/", "") = False Then File.MakeDir(File.DirRootExternal&"/ABT/", "")
If File.Exists(rp.GetAllSafeDirsExternal("/ABT/"),"") = False Then
File.MakeDir(rp.GetAllSafeDirsExternal("/ABT/"))
End If
End If
Else
'If File.Exists(File.DirRootExternal&"/ABT/", "") = False Then File.MakeDir(File.DirRootExternal&"/ABT/", "")
If File.Exists(rp.GetAllSafeDirsExternal("/ABT/"), "") = False Then File.MakeDir(rp.GetAllSafeDirsExternal("/ABT/"))
End If