Amit Chintawar
Amit Chintawar

Reputation: 20688

Android : Monitoring folder activity

I want to create an app which would monitor changes to data in a folder 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.

Upvotes: 1

Views: 2180

Answers (2)

ytw
ytw

Reputation: 1355

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

Upvotes: 6

arturh
arturh

Reputation: 6106

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.

Upvotes: -1

Related Questions