I have an app that observes a public directory on external storage with
It works fine on
Lollipop devices. I want to add support for
Marshmallow, so I set up a Nexus 9 tablet with it.
On the Marshmallow device, it fails, on Lollipop device it’s OK.
On Marshmallow device, the
FileObserver does not react to file system events that are caused by other processes. E.g. taking a screenshot, creating files via
It works fine if the files are created by my app.
Marshmallow, I ask for
READ_EXTERNAL_STORAGE permissions from
When I compile with API 23, I also make sure that I call
When I compile with API 22, I just rely on
It works if I observe stuff on
It fails if I observe stuff on
Did anybody test
FileObserver considreing all of the following? :
- API 23 and API 22?
- external storage
- files created by some other process than the observing app (e.g.
adbor taking screenshot).
This appears to be a bug in Marshmallow, see this link.
This is not fixed even in Nougat, you could get rid of the API this whole FileObserver, as it makes completely useless the fact that on most of the devices, it will not work.