My app requires a feature that backups WhatsApp status, voice notes, and images. As you know after Android Q google enforcing to access external media files using MediaStore API.
WhatsApp also moved their file to /Android/media/com.whatsapp/WhatsApp
. I tried using MANAGE_EXTERNAL_STORAGE
permission it works fine, but backing up these files is not the core functionality of the app, so I don't think google going to let me use this permission.
I wonder if there any way to read those files using MediaStore.VOLUME_EXTERNAL?
I tried something like this. I am not sure if this is even possible.
val collection = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL)
val selection= (MediaStore.Files.FileColumns.MEDIA_TYPE + "="
+ MediaStore.Files.FileColumns.MEDIA_TYPE_NONE)
val selectionArgs= arrayOf("%/WhatsApp/Media/.Statuses%")
val cursor = applicationContext.contentResolver.query(
collection, null, selection, selectionArgs, null)
debug(cursor?.columnCount)
cursor?.close()
it throws an exception.
Caused by: android.database.sqlite.SQLiteException: no such column: media_type
from Is it possible to get WhatsApp media file using MediaStore.VOLUME_EXTERNAL
No comments:
Post a Comment