3

There are two requirements

  • associate some sound properties, e.g. loudness or tempo, with every audio item on Android
  • efficiently query audio items using these properties, e.g. get top most loud tracks

I query MediaStore.Audio.Media.EXTERNAL_CONTENT_URI via ContentResolver to get audio items and analyze their properties.

The problem is how to associate these properties with audio items - there's no additional MediaStore table columns to keep user data.

Current solution is to create an internal database, store sound properties there and use MediaStore.Audio.Media._ID as a key to audio items.

Therefore, in order to get top most loud tracks, I need

  • query internal database and get item ids
  • query ContentResolver using WHERE _ID IN (...) clause and get audio items

This may introduce performance issues in general case (long list of ids). Moreover, things get complicated when I want to sync internal database with content provider, e.g. remove property records for previously deleted audio items. There is no info about deleted items in content provider, so I need to compare all ids from two sources.

So, my concerns are:

  1. There's no additional MediaStore table columns for storing user data, correct? Compare to ContactsContract.Data.
  2. There are problems with querying and syncing internal database with content provider. Are there ways to reduce them?

Possible solutions:

Community
  • 1
  • 1
vokilam
  • 10,153
  • 3
  • 45
  • 56

0 Answers0