I have a simple music player app that I created. So far it's been obtaining song metadata from android.provider.MediaStore
.
I obtain album art from the ALBUM_ART
column of MediaStore.Albums
. It returns a path to the album cover and I create a drawable from that for my custom song adapter.
But I noticed something strange recently. All my songs are in an external SD card. I removed the SD card from my phone, waited a while for the MediaStore to reflect the changes and opened my music app. As expected, all songs were missing.
Then, I placed the SD card back into the phone and waited again and re opened my app. All the songs showed up again, but this time, all album art was missing. Instead my default album cover image was being displayed which means that the album cover file path obtained from MediaStore was null.
I then opened a 3rd part music app on my phone (Musixmatch) and scrolled and noticed album covers were in fact showing up.
Now here's the part that I really don't get. I then opened up my app again and now, album covers were showing up. However, the album art of only the albums up to which I scrolled down to in Musixmatch were showing up. The rest were blank again. I then went back to Musixmatch and scrolled through the entire list of albums in my phone, waiting for each one's cover to show up. Then I went back to my app and as expected, now all the album art was loaded successfully from MediaStore.
How is it that the 3rd party music app was able to get MediaStore to cache album covers while my app couldn't? What is my app doing differently?