I'm trying to query MediaStore for all the playlists on a device; however, the query I'm using returns empty. I've looked at solutions to this issue but they only mentioned the device being mounted and I restarted my device unplugged and the issue wasn't fixed. Any help with my issue would be greatly appreciated.
private void getPlaylists(){
Cursor cursor = null;
String[] projection1 = {
MediaStore.Audio.Playlists._ID,
MediaStore.Audio.Playlists.NAME
};
cursor = getContentResolver().query(
MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
projection1,
null,
null,
null);
Toast.makeText(this, cursor.getCount() + "", Toast.LENGTH_LONG).show();
}
Thank you :)
The only difference between your code and mine is the use of Context