Android - Know when a file gets renamed

98 views Asked by At

In my Android app I need my app to get notified when some file (a picture file) gets renamed, something like a ContentObserver, but I need my app to be notified even when it's closed, so I would need something like a BroadcastReceiver. My app knows the paths of the folders it wants to listen to.

Do you know any way to do it?

1

There are 1 answers

0
CommonsWare On

There is nothing in Android that will notify you of arbitrary filesystem operations, except FileObserver, which requires your process to be running. In particular, Android does not issue a system broadcast for arbitrary filesystem operations, in large part due to the massive overhead that this would introduce.