Reputation: 21
It appears that with API32, the contentResolver no longer works for MMS Attachments
val partURI = Uri.parse("content://mms/part/$partId")
val inputStream = context.contentResolver.openInputStream(partURI)
inputStream?.let { inputStream2 ->
val file = File(context.getExternalFilesDir(null), fileName)
FileOutputStream(file).use { outputStream ->
val buffer = ByteArray(1024)
var read: Int
while (inputStream.read(buffer).also { read = it } != -1) {
outputStream.write(buffer, 0, read)
}
outputStream.flush()
}
}
inputStream?.close()
the attempt to open an InputStream results in an Exception:java.io.FileNotFoundException: Column _data not found.
Is anyone aware of how to read the data from MMS parts (attachments) with API 33?
In the manifest I have:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
and I dynamically request all the critical permissions:
Upvotes: 2
Views: 201