Android FileObserver battery drain

2019-07-27 20:35发布

问题:

I'm implementing a file observer in the main activity of a home replacement app. Does it drain battery?

Thanks

回答1:

FileObserver should not drain battery.

FileObserver listens for iNotify events, which are implemented as core functionality via the Linux kernel.

Just initialize your FileObserver with the events you want to listen to and implement the onEvent callback: it should be okay.