Search code examples
androidmediaandroid-contentprovider

How do I get the URI of a music from the MediaStore?


I can get the artist, title and track information from the MediaStore, but how do I get the path or uri of the media file I'm trying to play?


Solution

  • If you query the MediaStore content provider, the column you want is:

    MediaStore.Audio.Media.DATA
    

    If the media is on the SD card (or internal storage), that will be the path to the file.