After reading some links on internet, I started writing my own android app that copies the Viber database file on button click.
Now I want to write code that monitors the Viber db file and whenever any of them changes, it performs some operation like copying it to desired location.
So my main question is how to listen for a change in file that reside in private dir "/data/data/com.viber.voip/"?
You can use the Android FileObserver
class to monitor changes in files and directories.
FileObserver ob = new FileObserver("/data/data/com.viber.voip/") {
@Override
public void onEvent(int event, String path) {
// Do something
}
}
ob.startWatching();
Check the JavaDocs for more info.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments