Hello
I have a problem with writing permission (WRITE_EXTERNAL_STORAGE)
The solution I found in other discussions does not work
In manifest I put the following instructions:
I modified the copy routine in this way:
On a HUAWEi with Android 7.0 it works, on an Asus with Android 5.0 i get the error
EACCESS (Permission denied)
If i invert the instructions
I get the opposite result, it works on Android 5.0 but not in Android 7.0
What am I doing wrong ?
Thank you
I have a problem with writing permission (WRITE_EXTERNAL_STORAGE)
The solution I found in other discussions does not work
In manifest I put the following instructions:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
I modified the copy routine in this way:
B4X:
Sub CopyDBFromAssets (FileName As String) As String
Dim TargetDir As String
'If File.ExternalWritable Then TargetDir = File.DirDefaultExternal Else TargetDir = File.DirInternal
If File.ExternalWritable Then TargetDir =rp.GetSafeDirDefaultExternal("") Else TargetDir = File.DirInternal
If File.Exists(TargetDir, FileName) = False Then
File.delete(TargetDir, FileName)
File.Copy(File.DirAssets, FileName, TargetDir, FileName)
End If
Return TargetDir
End Sub
On a HUAWEi with Android 7.0 it works, on an Asus with Android 5.0 i get the error
EACCESS (Permission denied)
If i invert the instructions
B4X:
If File.ExternalWritable Then TargetDir = File.DirDefaultExternal Else TargetDir = File.DirInternal
'If File.ExternalWritable Then TargetDir =rp.GetSafeDirDefaultExternal("") Else TargetDir = File.DirInternal
I get the opposite result, it works on Android 5.0 but not in Android 7.0
What am I doing wrong ?
Thank you