Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: MediaStore is missing artists and albums
    primarykey
    data
    text
    <p>A project I'm currently working on requires the application to discover all audio tracks on an android device. In addition to the tracks, it must also be able to group them by album and artist.</p> <p>I found the MediaStore content provider and set about creating a database helper utility class to quickly return the IDs of tracks, albums and artists. I have been able to query the Media Store which returns <em>some</em> result, but it appears that not all of the audio information is stored there.</p> <p>For example, querying for all artists returns only 9 results, but the Android Music Player application returns 27.</p> <p>I am using the following code to query the artists:</p> <pre><code>ContentResolver resolver = getContentResolver(); String[] projection = new String[]{MediaStore.Audio.ArtistColumns.ARTIST}; Uri uri = android.provider.MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI; Cursor c = null; try { c = resolver.query(uri, projection, null, null, null); } catch (UnsupportedOperationException e) { Log.e("DatabaseHelper", "query: " + e); c = null; } if(c != null) { while(c.isAfterLast() == false) { Log.e("ARTIST", "NAME: " + cursor.getString(0)); cursor.moveToNext(); } } </code></pre> <p>It seems as if the Media Scanner (which is definatley run when my device boots up) is not detecting much of my audio library. Am I doing something wrong?</p> <p>I am simply trying to find all audio tracks, audio albums and audio artists quickly and efficiently. If MediaStore can't help me then I fear I will have to implement some form of file scanner to traverse directory structures and build my own database, but I don't want to do that ;)</p> <p>Any thoughts would be much appreciated.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload