Android image files deleted from com.android.providers.media/albumthumbs on reboot

12k Views Asked by At

My app is using images from folder /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs. When I change language and restart phone it is deleting image files from /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs. Now to recreate image file in that folder I have to launch native media player.

I am using Galacy S4 and issue is frequently happens when I change language to Korean.

Do someone know why it is deleting files on langauge change and restart and which action I can use inside my app to recreate image files in /com.android.providers.media/albumthumb like they are using in native media player.

If I delete all images from /com.android.providers.media/albumthumbs how I can fill it again will images of music files on launch of my app. Like if I launch Google Music of Samsung Music Player images are created in the folder. How I can do that on launch of my app.

1

There are 1 best solutions below

0
On

Maybe too late but I had the same problem in my app. A workaround which works for me is following

Firstly I load vie media store all album arts. So I can get some file paths but there is no files therefore for begin I check whether file exists

File f = new File(coverPath);

if(!f.exists()){

}

if not then I do this

public void loadAlbumArtById(long id) {
    try {
        Uri songCover = Uri.parse("content://media/external/audio/albumart");
        Uri uriSongCover = ContentUris.withAppendedId(songCover, id);
        ContentResolver res = this.context.getContentResolver();

        InputStream in = res.openInputStream(uriSongCover);
    } catch (Exception ex) {
        // do something
    }
}

Where Id is album id from media store (MediaStore.Audio.Albums._ID) After I run this function, art is available again, I don't know why, but it works for me