Search code examples
androidfileandroid-fileandroid-log

How to know if a certain file has been accessed/modified by some app?


My app should keep some files under watch. I want to detect any attempt to read/modify these files and which app did it so I can proceed accordingly.

Does Android log these types of actions?


Solution

  • You are welcome to use FileObserver for this. However, please bear in mind that this requires a continuously-running process, and that's impractical on most versions of Android. Plus, it will require a Notification (particularly on Android O and above), which users may not appreciate, since it shows that your app is continuously running, and they may not want that.