Questions tagged [fileobserver]

A simple abstract class developers can use to detect changes to a directory (nonrecursively) and fire callbacks as a result.

Monitors files (using inotify) to fire an event after files are accessed or changed by any process on the device (including this one). FileObserver is an abstract class; subclasses must implement the event handler onEvent(int, String).

Full Documentation Link: http://developer.android.com/reference/android/os/FileObserver.html

130 questions
0
votes
0 answers

FileObserver triggers event on self access

Hello i am using a FileObserver of java to monitor a path, whose contents are updated by some app suppose A and my app. Now the problem is when app A creates a file in the path, observer detects and triggers the event, then to process the file my…
Zain Ul Abidin
  • 2,467
  • 1
  • 17
  • 29
0
votes
0 answers

Why does FileObserver only work in /sdcard/data/[package_name]?

I am trying to monitor all files operations(create, read, write, modify, delete) in ‘/sdcard’ directory. It seems the class FileObserver could do the job from the documentation”https://developer.android.com/reference/android/os/FileObserver.html”.…
JJ Meng
  • 11
  • 2
0
votes
0 answers

Access Screenshots directory path for different devices programmtically

I have requirement that whenever use capture screenshot from any external or internal app then user should notify that screenshot has been captured. For that i came to know that i can use FileObserver. Okay, So i can do that. But my questions…
user6043117
0
votes
1 answer

FileObserver in Java (Android) triggered multiple times

I have implemented a file observer on a folder observing for the create & delete as follows: private FileObserver getFileObserverListener(String filepath, String fileType) { return new FileObserver(filepath) { @Override public void…
Adi
  • 361
  • 1
  • 5
  • 23
0
votes
1 answer

Android Background Service Limitation : FileObserver in Service or use Scheduler?

I need to implement fileObserver in background, so if new file arrives in observed directory, a notification will have to be triggered. Considering the background limitation implemented from Oreo, easiest option is just to launch fileObserver in…
0
votes
1 answer

How to generate an ID for a directory so that it can be tracked even after rename

Google Photos is able to restore your file to an album even if you rename it despite the photo not being in that directory. To make this possible one could use a FileObserver, but since you can't have a service run indefinitely how would you be able…
Chris Rohit Brendan
  • 893
  • 1
  • 9
  • 20
0
votes
1 answer

Android FileObserver does not trigger onEvent

I am trying to register a FileObserver inside of a service to monitor whenever a new photo has been saved to "/DCIM/Camera/". So far I have tried everything I could find online. In my opinion it should already work... i do request permissions in the…
darude_cod3r
  • 91
  • 3
  • 11
0
votes
1 answer

Stop service started at boot

I'm creating an android app that runs a service via a broadcast receiver at startup. The service, in turn, runs a fileobserver class to monitor a directory. When creating a file in the monitored directory, i need the service to restart. Is it…
0
votes
3 answers

FileObserver does not triggering events while invoking in background service

There are answered questions regarding FileObserver in Android and I am following them but still my code doesn't work. Here I am posting my code, I am trying to set fileObserver via service so it work even if the app itself is closed. When running,…
Manoj Pathak
  • 209
  • 1
  • 5
  • 15
0
votes
1 answer

FileObserver as continuous service

I want to implement a FileObserver to write a log whenever a certain file is changed. This should run anytime between boot and shutdown. After starting it no activity has to access it again. I wrote a Service holding the instance of my…
phoeller
  • 58
  • 1
  • 10
0
votes
0 answers

FileObserver.MODIFY event caught just after FileObserver.CREATE

Whenever a new photo is created (i.e. a new photo is clicked from a camera intent) in the directory I am monitoring, the onEvent method first catches the FileObserver.CREATE event, and immediately after that, it catches FileObserver.MODIFY event.…
Preetom Saha Arko
  • 2,588
  • 4
  • 21
  • 37
0
votes
0 answers

Detect screenshot and open screenshot file

Hi I am creating an application that would detect if a screenshot has been taken and then retrieve that particular screenshot. So I have been able to detect if screenshots are taken. But I am wondering how would I be able to get that screenshot that…
user6150841
0
votes
1 answer

onEvent not detectig any event in my app

I'm trying to keep a watch on Screenshot directory of my phone using FileObserver, I tried all events, the method onEvent id not getting called on any event. What i did is after installing the app, took one screenshot but the method didn't get…
0
votes
1 answer

android how to tell when music is playing/paused

I am making an app which starts and runs a process whenever any music player is playing music, and pauses the process when the music is paused(or during a phone call); I thought I could just use FileObserver to see when a music file was accessed(it…
0
votes
1 answer

Duplicate looping

Here is my FileObserver code: private void updatecheck() { // Email sync loop mHandler.post(new Runnable() { @Override public void run() { if (Looper.myLooper() == null) { Looper.prepare(); …
1 2 3
8 9