Let’s suppose that: I delete an item from my sd card and then, I unmount the memory card.
What happens when Android rescans my sd card for changes? In MediaStore, every row has a _ID so after I delete an item what happens to this _ID:
- Does it remain in MediaStore, it is associated with another item, or,
- It is removed permanently?
I had the same question and the best way to find out the answer is to do the test.
based on what I saw, it works like that:
1) id is started on 1 and increments by 1 when new images or videos are added by media scanner
2) if you delete the file and mediascanner does not know about that yet and you will try to fetch from mediastore, the record still will be there
3) once mediascanner sees that file is gone, it will remove the record from mediastore db
4) the id of the removed record won’t be used so if you had three items with ids 1,2,3 and drop item 2 and add a new one, the list will look like 1,3,4 – so deleted ids won’t be reused