java.lang.IllegalArgumentException: Unknown URL content://media/external/images/media at android.content.ContentResolver.insert(ContentResolver.java:1837)
with some device.where the faulty device is Redmi 9A
ContentResolver contentResolver = context.getContentResolver();
ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.MediaColumns.TITLE, fileName);
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, fileName);
contentValues.put(MediaStore.MediaColumns.MIME_TYPE, getMimeType(context, Uri.parse(pathFile)));
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_PICTURES);
contentValues.put(MediaStore.MediaColumns.IS_PENDING, Cursor.FIELD_TYPE_INTEGER);
// add datetime
long now = System.currentTimeMillis() / 1000;
contentValues.put(MediaStore.MediaColumns.DATE_ADDED, now);
contentValues.put(MediaStore.MediaColumns.DATE_MODIFIED, now);
contentValues.put(MediaStore.MediaColumns.DATE_TAKEN, now);
//Media image.
Uri uriTarget = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
Cursor.FIELD_TYPE_INTEGER
What would that be? – NibbsRedmi 9A
– Yea