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
2
votes
0 answers

I would like to backup file x before its deleted in android

I would like to backup file x before its deleted . With FileObserver I would just get information that file was deleted ... Is it possible to access file just before event occur , like just before deleting its create back up in my sdcard and other…
2
votes
1 answer

Register FileObserver after mounting SD card

In my application I need to increase the count of photos when one is captured. So I set a FileObserver for the DCIM directory. It watches for captured photos. However, this FileObserver stops watching when I unmount my SD card because the DCIM…
thej
  • 648
  • 10
  • 33
1
vote
1 answer

FileObserver not working on Android SDK 30

I am working on an android application where i have used FileObserver to get data changes on a specific folder. The folder is WhatsApp Images and whenever there is a new file added to that folder i perform my further work when onEvent of…
User
  • 692
  • 2
  • 11
  • 29
1
vote
0 answers

Trigger when a new file is created android

I'm trying to create an app that notices when a new file is created in a certain directory of Internal Storage... I've tried with WatchService with no success : AccessDeniedException WatchService android studio I've also tried with FileObserver but…
SempriGno
  • 21
  • 3
1
vote
1 answer

FileObserver in Android 8 does not fire the CREATE event

In Android I use the FileObserver to observe a folder and do something when a new file is created. I noticed that the CREATE event is generated on Android 5 and Android 7 but it is NOT generated on Android 8. Any idea why? This is the…
Klaus78
  • 11,648
  • 5
  • 32
  • 28
1
vote
0 answers

File Observer not working on some devices

I am trying to make Android app like File recovery, and for that, I am using FileObserver in my app. in my app I am Observing all the file and detecting when any file gets deleted. My app is working on some device like Motorola, and Asus. But it is…
Milind Gandhi
  • 91
  • 1
  • 7
1
vote
1 answer

Fileobserver's onevent method fire but how can i get file before deleting any file

i want to copy file before deleting an image from any file manager or gallery but FileObserver's onEvent fire but i want specifically get event only when user delete any file from FileObserver's watching path observer = new…
user9140980
1
vote
1 answer

The Google Drive Android SDK sync local folder strategy

I read throughly development documents, sample code and SO related Q&A, it seems the Google Drive Android SDK doesn't include any functionality to automatically sync local folders. Therefore I am going to build one by my own, and here is the…
1
vote
0 answers

Android: FileObserver doesn't trigger OPEN event on some phones

I'm developing an app that notices when a file inside a directory is opened by another application. I therefore use a FileObserver that observes the directory. When I'm running my application on a Nexus 5 (Android 6.0.1) or Huawei P10 (Android…
Jan
  • 11
  • 2
1
vote
0 answers

Backgroundservice is running, but not working (FileObserver)

I want to run a Backgroundservice (FileObserver) that will look for any filechanges in the system (CREATE, DELETE, MOVE, ...). When I start my application it works a few seconds and logs everything fine. For example at taking a picture by the camera…
1
vote
0 answers

FileObserver only catches delete event

I have a Service which starts a FileObserver to monitor pictures which are taken by the phone camera, in particular thefile : String initialPictureFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString() +…
t_k_94
  • 37
  • 1
  • 4
1
vote
1 answer

FileObserver callback won't trigger (Related topics on stackoverflow mentioned in details)

I'm trying to listen to any event in external storage directory, i.e. file added, removed or modified through Android FileObserver but its onEvent method never gets called. I've tried all of the following solutions: Android FileObserver…
AwaisMajeed
  • 2,254
  • 2
  • 10
  • 25
1
vote
0 answers

FileObserver not working with intent

I need to use camera intent and keep track of the new images taken by the intent. As I need to take multiple photos at a time, I used the intent MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA. Here is my code: package com.arko.cameraintent; import…
1
vote
1 answer

How to use FileObserver in Android to Monitor "/sys/class/"

I am trying to monitor the "/sys/class/udc" folder by using FileObserver. My app is a system-priv app, so there should not be a permission issue. I am unable to detect the change event. String path = "/sys/class/udc"; static final int mask = ( …
1
vote
1 answer

Android - listening for new image files

My app keeps a database with some info about all the images on the user's phone. However, once they add new ones (by taking e.g. a picture), my app should be able to know this, and add the info of the new image to the database. Obviously don't want…
1 2 3
8 9