I am writing a small music playback application. My goal is Android API 7 and above.
The application should only display and play music marked with a specific set of genres selected by the user through settings, for example. Pop, Rock, Hillbilly.
Now I'm trying to find an effective way to find all album identifiers and album names containing tracks marked with selected genres.
It is easy in SQL. The phone stores multimedia metadata in a sqlite database. I found it on the phoneβs internal memory, copied it using adb and tried some SQL queries on it. The resulting query is a single-line SQL code with a connection chain and works fine.
This seems more complicated in Java with the Android SDK, at least with API level 7 and above. I can use managedQuery on MediaStore to do some limited SQL syntax in the same base database, but if I get things right, then using this API there will be no JOIN and DISTINCT.
Also, I might have missed this, but MediaStore allows me to search all tracks of one genre, but not for all tracks of several genres in a single query.
So this all works a bit in Java. Now the program needs to make several managedQuery () calls for each genre, and the program should join the results and make them different from java, outside sqlite (where this work belongs).
Is this really the way it should be done? Can't just send a raw query to sqlite database file?
Thanks!
source share