ranjithstar256 ranjithstar256 - 1 year ago 58
Android Question

android code to detect if there is any changes in the contents of a folder

Is there any way that i can detect if there is a change in the contents of a folder which is in android device storage?

i want to detect if the user adds files to that folder, i what to perform some action.How can i do this?

Actually my exact requirement is, whenever the user saves data in my app, i want that to be uploaded to my server. so if there is a change in that specific folder, i'll run the upload activity.
Any help please.

In Short:
whenever there is a changes in the contents of the folder i what to trigger another event. i want the changes in the folder be the trigger.
Any help will be appreciated.

Answer Source

use FileObserver http://developer.android.com/reference/android/os/FileObserver.html. You might need to make it recursive to catch sub-directories

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download