Updated link 5-4.4.3.
Fileobserver does not work for any directory. I tried 1./data/data/com/whatsapp, 2.sdcard / Movies, and also 3. "/". Before the update, it worked fine.
I saw RecursiveFileObserver on github and used it along with a file server. When both are used together, the onEvent of my FileObserver is called, which is rather strange. After a while, ANR appears.
So how to use fileobserver in android 4.4.3
Here is my code
FileObserver observer = new FileObserver("/data/data/com.whatsapp/databases") {
public void onEvent(int event, String file) {
Log.i("ASH", "path VSLLED");
Log.i("ASH", "path AXCCESSED " + file);
}
};
observer.startWatching();
and link for RecursiveFileObserver https://github.com/bartoszprzybylski/owncloud-android/blob/master/src/com/owncloud/android/utils/RecursiveFileObserver.java
Btw, FileObserver runs on a service