I set up a test program to learn more about FileObserver in android SDK (2.2).
It seems to work fine when FileObserver is set up to watch “/mnt/sdcard”. The onEvent() function gets called when some file system changes occur inside “/mnt/sdcard”.
However, if I change FileObserver to watch “/data”, the onEvent() function no longer gets called even when I make file system changes in “/data”.
Thanks in advance for any comments or answers.
You do not have read access to the whole of
/data, so I am not surprised thatFileObserverdoes not work for it.Try using
FileObserverwith a more narrow scope (e.g., your owngetFilesDir()) to which you have read access.