Hi All,
This is my first post on B4A-Android, as till now I got resolution's for all my issues in the forum.
However, its been 1week now, I have been looking for the solution on the Content Chooser crash issue.
Code snippet to copy chosen file to "audio.mp3" :-
Manifest
Below crashes are logged for ContentChooser_Result on different devices.
1.Fatal Exception: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media/113228 from pid=19038, uid=10267 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission().
2.Fatal Exception: java.lang.SecurityException: com.venir.destem has no access to content://media/external/audio/media/143
3.Fatal Exception: java.io.FileNotFoundException: Can't access /storage/0000-0000/Dunsin-Oyekan-Fragrance-To-Fire.mp3
4.Fatal Exception: java.io.FileNotFoundException: /storage/emulated/0/Music/Asylzhan Abdulla - Ұнайсың.mp3: open failed: EACCES (Permission denied)
Note:- On some devices it works fine even with the sdcard/external file chosen.
Any idea what could be the reason behind this crashes?
This is my first post on B4A-Android, as till now I got resolution's for all my issues in the forum.
However, its been 1week now, I have been looking for the solution on the Content Chooser crash issue.
Code snippet to copy chosen file to "audio.mp3" :-
B4X:
Sub Process_Globals
Dim uploadFolder As String
Dim rp as RuntimePermissions
End Sub
Sub Activity_Create(FirstTime As Boolean)
uploadFolder = rp.GetSafeDirDefaultExternal("uploads")
CC.Show("audio/mpeg", "Choose audio file")
End Sub
Sub CC_Result (Success As Boolean, Dir As String, FileName As String)
If Success = True Then
File.Copy(Dir,FileName,uploadFolder,"audio.mp3")
Else
ToastMessageShow("No File Selected",True)
End If
End Sub
Manifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="23" 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.DarkTheme)
Below crashes are logged for ContentChooser_Result on different devices.
1.Fatal Exception: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media/113228 from pid=19038, uid=10267 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission().
2.Fatal Exception: java.lang.SecurityException: com.venir.destem has no access to content://media/external/audio/media/143
3.Fatal Exception: java.io.FileNotFoundException: Can't access /storage/0000-0000/Dunsin-Oyekan-Fragrance-To-Fire.mp3
4.Fatal Exception: java.io.FileNotFoundException: /storage/emulated/0/Music/Asylzhan Abdulla - Ұнайсың.mp3: open failed: EACCES (Permission denied)
Note:- On some devices it works fine even with the sdcard/external file chosen.
Any idea what could be the reason behind this crashes?