Created
February 5, 2012 12:25
-
-
Save SunRain/1745187 to your computer and use it in GitHub Desktop.
FileObserver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://developer.android.com/reference/android/os/FileObserver.html | |
Monitors files (using inotify) to fire an event after files are accessed or changed by by any process on the device (including this one). FileObserver is an abstract class; subclasses must implement the event handler onEvent(int, String). | |
Each FileObserver instance monitors a single file or directory. If a directory is monitored, events will be triggered for all files and subdirectories (recursively) inside the monitored directory. | |
An event mask is used to specify which changes or actions to report. Event type constants are used to describe the possible changes in the event mask as well as what actually happened in event callbacks. | |
Warning: If a FileObserver is garbage collected, it will stop sending events. To ensure you keep receiving events, you must keep a reference to the FileObserver instance from some other live object. | |
frameworks/base/services/java/com/android/server/RingerSwitchObserver.java | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment