Unknown URL content://media/external/images/media at android.content.ContentResolver.insert
Asked Answered
M

0

9

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);
Maas answered 1/11, 2020 at 15:7 Comment(13)
Does Android version of device differ?Nibbs
Android device 10.Maas
Cursor.FIELD_TYPE_INTEGER What would that be?Nibbs
this is number 1Maas
Even if it does it is unreadable code.Nibbs
Have the same bug report, from the same device (Redmi 9A). Did you figure it out by chance?Prong
Hi Dimezis, no ;((Maas
Have the same bug report, from the same device Redmi Note 7S. Anyone is figured out? @ProngLashing
Did you manage to resolve this issue?Miserable
Hi @AnkitBatra no:(((Maas
We see it as well for the same Redmi 9AYea
Does any solution find?Deposal
no :(. i not find solution on device.Maas

© 2022 - 2024 — McMap. All rights reserved.