6

Is it possible to detect folder changes in Android? I mean detect when files are deleted or changed and know which application are doing these? In Windows you have system events for this, it's not necessary to permanently watch the files to detect changes. It's very important to know which application is doing the changes.

1 Answer 1

9

Is possible to detect folder changes in android?

You can use FileObserver to find out when files are modified.

Is very important to know wich application is doing the changes.

That information is not available.

Sign up to request clarification or add additional context in comments.

11 Comments

FileObserver!, that is exactly what I need... but do you have any idea of how can I know which application are making the changes to the files?. I need this information because I and too many others users of android are having problems with random deleted files, and all of these files are media files (pictures and videos). I need to make an application to know the origin of this problem to solve it.
Is there a way to do this passively? I don't want to require my app to be loaded into memory to know if a file is added/removed.
@Justin: "Is there a way to do this passively?" -- not really. Scan the directory of interest when your app next runs and look for changes, I guess.
@Justin you could try putting it into a service. I'm going to play with it a bit tonight to see if I can find a way to passively detect file creation.
@ArielLarraburu I am having the same issue in 2019 with my photos randomly disappearing, and after ensuring that nobody else has access to any of it, it's still happening. Any update on what you found out?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.