My app keeps a database with some info about all the images on the user's phone. However, once they add new ones (by taking e.g. a picture), my app should be able to know this, and add the info of the new image to the database. Obviously don't want to loop through entire database to check which ones are the new images..
My research shows that I can have a "file listener" using the FileObserver. However, I understand this only works while my app is running. So if I implement a FileObserver, close the app and then open it, would I be able to know which ones are the new images, since the last opening of the app?
If not, then I understand I need to have some sort of background service, but in the documentation it says they should be implemented to only use simple/non-heavy operations... and since I'll be observing all subdirectories (recusrively) for new images with FileObserver, I suppose this would be an expensive operation? And what happens if the service stops running, and during that time new images are added. Would FileObserver pick this up?
Thanks