Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content Observer with Files?

So my Question is to know if ContentObserver can be used to Monitor a Folder and get Notified when a file is Created/Removed ?

in my Case , i want to Monitor the Camera Folder and get Notified when a new file is Created (Picture Taken) ,

Thanks .

like image 580
user1839514 Avatar asked Mar 05 '26 21:03

user1839514


1 Answers

So my Question is to know if ContentObserver can be used to Monitor a Folder and get Notified when a file is Created/Removed ?

No.

in my Case , i want to Monitor the Camera Folder and get Notified when a new file is Created (Picture Taken)

You can either use a ContentObserver with MediaStore to find out when any images are added or removed, or you can use FileObserver to monitor the standard path to pictures on external storage.

Neither of these will necessarily reflect "Picture Taken", as camera apps do not have to store their images in that specific folder, nor do they have to have their images indexed by MediaStore.

like image 151
CommonsWare Avatar answered Mar 08 '26 13:03

CommonsWare