Skip to content Skip to sidebar Skip to footer

How Unique Is _id Column In Android Mediastore?

I'm developing an Android music player app that has a capability of saving playlists (collection of musics) to disk. However I got some questions, I have googled it but nothing can

Solution 1:

Although this is an old question, the above answer is incorrect. Simply deleting or adding new music will be fine as Android will assign it auto-incremental _id. However, when you simply move a file(in your case, a song), the _id column changes values! It's almost like the MediaStore deletes the entry first and then creates a new entry.

So, for your point 2, those ID's could become stale over a period of time when users move their songs around.

Solution 2:

_IDs are unique. Just like databases the ID is usually autoincremented. So if a item is added it will use the previous added ID + 1. So if you delete an item, the other IDs in the database are not changed (so there will be gaps => no worries)

So for question 2, it's safe.

Post a Comment for "How Unique Is _id Column In Android Mediastore?"