32

I've noticed that Android keeps the same music playlists across music apps. Where are these playlists stored? How (in what format) are they stored? Can I access them remotely via the USB storage link, or is there instead an app I can use to access them?

Related question: Music transfer and playlists

24

They're stored in your music.db file - mine is /data/data/com.google.android.music/databases; I'm not sure if this is exactly the same across all devices but I'd guess it probably is.

They live in a combination of the LISTS and LISTITEMS tables, which are defined as such:

sqlite> .schema lists
.schema lists
CREATE TABLE LISTS(Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT NOT NULL, 
    SourceAccount INTEGER, SourceId TEXT, _sync_version TEXT, 
    _sync_dirty INTEGER NOT NULL DEFAULT 0, MediaStoreId INTEGER, 
    ListType INTEGER NOT NULL DEFAULT 0, ListArtworkLocation TEXT);
CREATE INDEX LIST_SYNC_INDEX on LISTS(SourceAccount,SourceId);
sqlite>

sqlite> .schema listitems
.schema listitems
CREATE TABLE LISTITEMS(Id INTEGER PRIMARY KEY AUTOINCREMENT, 
    ListId INTEGER NOT NULL REFERENCES LISTS, MusicSourceAccount INTEGER NOT NULL,  
    MusicSourceId TEXT NOT NULL, ClientPosition INTEGER NOT NULL, 
    ServerPosition INTEGER NOT NULL DEFAULT 0, SourceAccount INTEGER, SourceId TEXT,
    _sync_version TEXT, _sync_dirty INTEGER NOT NULL DEFAULT 0, 
    ServerOrder TEXT DEFAULT '', ClientId TEXT);
CREATE INDEX LISTITEMS_ORDER_INDEX ON LISTITEMS (ListId, ServerOrder, ClientPosition);
CREATE INDEX LISTITEMS_SYNC_INDEX on LISTITEMS(SourceAccount,SourceId);
sqlite>

Interestingly, if you're using the new Google Music Beta, playlists that you create don't seem to appear in other apps but they do have entries in the DB. It looks like this is possibly because the MusicSourceAccount field is set to your Google Music account id; other apps set it to 0, and those appear across all apps that take data from the DB.

1

I found a post from XDA Developers.

If anyone reading this doesn't find it on the directory listed above, try this one instead:

/data/data/com.android.providers.media/databases/external-{{some hex here}}.db

You can then copy it to your computer, use the SQLite editor of your taste and manipulate the data at your own will.

protected by Community Jun 1 '18 at 8:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.