For about a month my Galaxy S2 runs Android 4. And I gotta say, I like Ice Cream Sandwich.

Sure, it’s not really all that different, but there’s a lot of small stuff that makes the user experience more pleasant. Thanks to an seemingly overall better performance Ice Cream Sandwich can afford adding a little eye candy like window transitions without sacrificing speed. And I really like the new system settings menu.

Under the hood there is still a lot more than we see now. The problem with this simply is that we’re not seeing enough applications using the Android 4 API, which of course provides programmers with access to all the new features.

So it’s been a month, and while enjoying the benefits of the update I also ran into a problem. And of course the problem was my application StoryTeller.

In order to scan for music I scanned the system’s music folder file by file, using MediaMetadataRetriever to read the data from the files. For some reason I still don’t understand this broke with the Android 4 update. The file by file scanning still works, but MediaMetadataRetriever seems to be unable to provide any data other than the album artwork. But of course this does not happen in the Android emulator, only on our Galaxy S2s. And this might be limited to MP3, with Ogg/Vorbis still working.
In case anybody would like to look into this and provide me an answer an why this is broken, and if other Ice Cream Sandwich phones are affected can just try out StoryTeller 0.10.10, which still uses the old code.

I have now finally gotten round to fixing the problem, ending up throwing the whole scanning code into a separate class, which allowed me to easily switch between the old and the new code for testing.
The new code now uses a ContentResolver to retrieve the information from the MediaStore, thus completely bypassing the need to actually scan files and effectively cutting a big chunk off the scan time.

Overall this experience was quite interesting, although I still don’t understand the cause. It was good to get back into the code and I’m quite happy about now having the media scanning code in a separate class. And classes the contain album and track information. That way future changes will only have the requirement to provide the same interface to other classes in order to work without changing any other code than the actual scanning code.

Next I think I will try to come up with some random project to have a closer look at the Android 4 API and it’s new functions. And there’s still stuff I need to do on StoryTeller.

Thank you!
Dennis Wronka