views:

40

answers:

1

I have a music player app on the Market and my users starting reporting problems with music showing up as "Unknown Artist" and "Unknown Title" after the Froyo update. I have noticed the same behavior on my Motorola Droid 2 running Froyo. Doing some googling, I find other users (and even Last.fm confirmed the issue) that "Android" is not reading/storing tags correctly. I can't find any technical/developer feedback on this issue.

Here's the code that has been working for 6 months prior to Froyo:

        String whereclause = MediaStore.Audio.Media.DATA + " = \"" + path
                + "\"";
        curSong = CR.query(MediaStore.Audio.Media
                .getContentUri("external"), new String[] {
                MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ALBUM,
                MediaStore.Audio.Media.ARTIST }, whereclause, null, null);
        if (curSong != null) {
            curSong.moveToFirst();
            title = curSong.getString(0);
            album = curSong.getString(1);
            artist = curSong.getString(2);
        }

After the query, curSong is not null, so the "if" block continues, but then I get CursorIndexOutOfBounds when trying to read curSong.getString(0). Is there some new way that Froyo stores the tags in MediaStore?

Update 1:

After some debugging, I find that the ID3 tags are just fine and still in the same place. The problem is with my whereclause. I am looking the song up by its path, which was previously stored in MediaStore.Audi.Media.DATA, but is apparently no longer there, so I'm actually getting an empty set form this query. Now I need to find where that path is stored.

A: 

I found the problem. The path is still being stored in MediaStore.Audio.Media.DATA, however, it appears that Froyo added "/mnt" in front of "/sdcard". When I added "/mnt" to the path in the whereclause, it was able to find the song and all is well.

I hope this helps someone else in the future.

RMS2