I want to save some data in File.DirInternal using the FilePicker library from DonManfred.
When initializing the filepicker I set File.DirInternal as root directory. When I run the app in debug mode I get the message:
"Application needs your permission to access SD card". The compiled app just crashes.
Regards,
I know it sounds like it should "not" need permission because the directory is "internal" to the app.
But see if it does fix the issue if you try adding in the read and write permissions for the external storage as shown in the READ_EXTERNAL_STORAGE / WRITE_EXTERNAL_STORAGE section of this page:
1. Edit: In B4XPages the permission result event signature is: Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean) 2. Important to read: https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/#content If the targetSdkVersion is...
@JohnC : You are correct, you do not need permission to access File.DirInternal. Data in the internal folder is private to the app. It can only be accessed within its app. I do not think you can use file provider to even access it. This is how I knew it, unless things changed and I am not aware of it.
Thank you all for your support. Now I know that File.DirInternal is for the App only. Not for storing userfiles.
I use this directory because any other directory fails with FilePicker. I wanted to use File.DefaultDirExternal but then I get the message that the directory cannot be found and the default directory will be used instead. And in fact it doesn't. The directory "/storage/emulated/0/Android/data/b4a.example/files" just is not there. I tried to make the directory myself but that doesn't work.
Regards,
This is a wrap for this github project. The lib requires B4A 6+ This is my 100. Library-Release for B4A :) FilePicker Author: DonManfred (wrapper) Version: 1.01 DialogProperties Methods: Initialize (EventName As String, root As String, selectionMode As Int, selectionType As Int...
www.b4x.com
So it would be mandatory to use Runtimepermissions and request Permission for.
Still one question: how to retrieve the full filenaam chosen in FilePicker.
I tried:
B4X:
Sub FilePicker_onSelectedFilePaths(selected() As String)
FileNaam = ""
For i = 0 To selected.Length -1
FileNaam = FileNaam & selected(i)
Next
fp.dismiss
End Sub
But the App crashes when I use Filenaam to open the chosen file. The error states it is a directory.
I suggest to understand what the Event deliver to you and what you do with the given info.
The event is named onSelectedFilePaths so it suggests a multiple List of a FilePath.
It makes no sence to combine the answers. Probably only one is inside the List.
Away from that at the end you have FileNaam with a PATH filled.
Maybe you just selected a Folder instead of a File?
To help you you should have posted what the Result is in that event. Add log output to the event.
For any other question: Please start a new thread for any new Question/Issue you have. One thread should summarize one Question.