Tim Malseed
04/03/2020, 1:06 AMcontext.contentResolver.delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, "${MediaStore.Audio.Media._ID} = ?", arrayOf(id.toString()))
Supposedly, if I don’t have permission, this should throw a RecoverableSecurityException
on Android Q, and I should be able to use an IntentSender to have the user grant permission.
Instead, I just get a result of 0
from the delete()
call, meaning no files were deleted.
Any ideas?tseisel
04/03/2020, 6:55 AMContentUris.withAppendedId(Media.EXTERNAL_CONTENT_URI, longId)
.
For more information see my question an its excellent answer on SO: https://stackoverflow.com/questions/58283850/scoped-storage-how-to-delete-multiple-audio-files-via-mediastoreTim Malseed
04/03/2020, 7:35 AMaudioContentUri
was for a while, but I did get it wokring. Turns out the underlying file isn’t deleted even when contentResolver.delete() returns >= 1tseisel
04/03/2020, 7:52 AMrequestLegacyExternalStorage="true"
until at least Android 11 (but that flag is still allowed on Android 11 !)