33

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

1

2 Answers 2

26

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
  • Nice! But how do you run this SQL query on your mobile phone? Are you using a DB tool for that? Which one?
    – Matt
    Commented Jul 4, 2022 at 6:56
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .