开发者

Android MediaStore sqlite db location

开发者 https://www.devze.com 2023-01-13 06:33 出处:网络
I am trying to find the sqlite dat开发者_运维知识库abase used by the MediaStore. As far as I understand, the MediaStore contains amongst others the playlists defined in the default Music app. I actual

I am trying to find the sqlite dat开发者_运维知识库abase used by the MediaStore. As far as I understand, the MediaStore contains amongst others the playlists defined in the default Music app. I actually would like to duplicate a playlist, but the app does not allow that. Somehow I thought I could fix this if I just could find the actual db file. But I got completely sidetracked now, because I just cannot find the db. Btw, I am running FroYo.


Having a look at the Android source the class we're interested in seems to be android.provider.MediaStore and in there, the getDatabaseForUri() method seems generate a different database for each external storage card and one called internal.db.

So I think the file you're interested in is:

/data/data/com.android.providers.media/databases/internal.db

However, my copy of that database doesn't have the audio_playlists table used in the Java source so I'm not certain this is right.


The proper way to do this is to use the content provider to query media store and do any kind of modifications to the tables from there.

Quick example of how you would query all artists in the MediaStore.

String[] proj = { MediaStore.Audio.Media._ID,
                        MediaStore.Audio.Media.DATA,
                        MediaStore.Audio.Media.DISPLAY_NAME,
                        MediaStore.Audio.Artists.ARTIST };
            //managed query doesn't need startManagingCursor called on the cursor
            Cursor c = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                        proj, null, null, null);


the location is:

/data/data/com.android.providers.media/databases/internal.db

audio_playlists not in Tables, you can see it in Views. sql tool is:sqliteman,ubuntu13.10

0

精彩评论

暂无评论...
验证码 换一张
取 消