I want to create an app which would monitor changes to data in a folde开发者_StackOverflow中文版r on SD card. For example if a file is put in a folder, as soon as file is copied, my app would send this file to server and delete this file. Is it possible to do this?
Thanks.
I think you can use android.os.FileObserver which is available since API Level 1. Source: http://developer.android.com/reference/android/os/FileObserver.html
I looks like there is no system-wide "FileSystemMonitor" you could connect to.
So you have to write it yourself. You could for example receive the ACTION_TIME_TICK broadcast and check the filesystem for changes yourself every minute using the normal java File classes.
精彩评论