http://developer.android.com/reference/android/os/FileObserver.html
But trying to watch for any change on any file is potentially extremely expensive, since you need to be monitoring every single directory on the file system, and updating what you are monitoring as directories are created or removed. This is just a fundamental aspect of how file monitoring works on Linux, so there is not much to do about it. I would strongly suggest trying to find some other approach that does not require monitoring the entire file system. :} On Thu, Aug 13, 2009 at 12:36 PM, Casper Bang <[email protected]> wrote: > > Filesystem monitoring is only provided in Java in the NIO2 stuff > coming with Java 7. Android supports a subset of Java 6 so perhaps you > can port this over yourself by looking at their source. As far as I > know though, even the NIO2 will often need to use constant polling > which would absolutely kill the battery life of an Android device I > think. > > So the real question is whether it's possible to hook into some native > Android services and be notified regarding writes to /sdcard but I > fear, if even possible, this require a rooted phone. > > /Casper > > On 13 Aug., 21:05, "Mapara,Harshit Nitinkumar" <[email protected]> > wrote: > > Hi All, > > > > I am creating an app and the requirement is - I have to listen to the > > SD card for new data comes in. > > > > Whenever a new file is downloaded into SD card , I want to be notified. > > (or say , I want to listen for changes) > > > > I searched, but can't get any useful help. > > > > Please help me in this issue. > > > > Any code sample, link will be nice to have. > > > > Thanks > > Harshit > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

