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
1 answer

Android detect camera capture event using FileObserver

How can I detect when user take a picture in their camera? I'm running in service. I want to get byte data of it. String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera"; fileObserver = new FileObserver(path) { …
Lazy
  • 1,807
  • 4
  • 29
  • 49
0
votes
1 answer

FileObserver onEvent method not called saving videos

I'm using MediaRecorder to create videos in my Camera app; in the "prepare method" I set the output file with recorder.setOutputFile(getOutputMediaFile(MEDIA_TYPE_VIDEO).toString()); while the getOutputMediaFile method is the following private void…
sbomb
  • 1
  • 3
0
votes
2 answers

Long running operation inside onEvent of FileObserver

I have an activity that contains an Instance of FileObserver. I start watching in onCreate and stop watching in onDestroy of the activity. So what happens if onEvent is doing some operation and the activity is destroyed (user presses back button)?…
Nouvel Travay
  • 6,292
  • 13
  • 40
  • 65
0
votes
1 answer

Android method is not running

It has been a long time since I stopped by this problem: my FileObserver's onEvent method is not triggered, tested, and not even the "method entered" toast is being displayed. FileObserver fileObserver = new…
0
votes
1 answer

My onEvent() part of the File Observer method doesn't work

I have already scanned all of the related questons&answers here, but I still couldn't find the solution. the service class file: public class otser extends Service { private WindowManager windowManager; private ImageView chatHead; @Override public…
0
votes
0 answers

Python stop and start directory observer

I have a GUI and a button that toggles an observer. def start(self): self.observer.schedule(event_handler=update, path=self.path, recursive=False) self.observer.start() def stop(self): self.observer.unschedule_all() …
cre8
  • 13,012
  • 8
  • 37
  • 61
0
votes
1 answer

Fileobserver for facebook picture upload in android

In my android application, I am running a background Service and the service runs some code if a user takes a picture from facebook application. The service is doing that by using fileobserver to observe storage/emulated/0/Pictures/Facebook/ folder.…
user2858924
  • 433
  • 5
  • 15
0
votes
1 answer

No Event is triggered by FileObserver

May be this is a weird question but I'm working with FileObserver first time. The code I've written is public class FileChanges extends FileObserver { public static int CHANGES_ONLY = CLOSE_WRITE | MOVE_SELF | MOVED_FROM; List
TechArcSri
  • 1,982
  • 1
  • 13
  • 20
0
votes
1 answer

Android service file observer strange behavior

I need to implement a service in android that must be able to monitor a folder to detect a certain file and read what it contains. I'm having a strange behavior with my code and I can't find the reason. This is my relevant code. public void…
acostela
  • 2,597
  • 3
  • 33
  • 50
0
votes
0 answers

FileObserver throws Throwable in one of my devices

I've got 2 different devices in which I'm testing my App. One of them has Android 4.0.3 and the other one 4.3. Normally, I don't care which one I'm using but as I need to upload files to dropbox and download them in other device, I started to use…
Fernando
  • 751
  • 2
  • 13
  • 27
0
votes
1 answer

Can i throw a Notification from a File Observer?

I'm building this app in which I need to monitor a folder, when a file is modified (creatd, deleted, doesn´t matter) I have to notify the user. I have tried many ways and I can't reach the goal of running a notification because FileObserver is an…
0
votes
2 answers

Why FileObserver not working for /data/anr/traces.txt?

Android application have read/write permission for /data/anr/traces.txt. But still FileObserver does not seem to work for it. What else is required for FileObserver to work? It works fine for sdcard file. Code: mFileObserver = new…
AndRSoid
  • 1,777
  • 2
  • 13
  • 25
0
votes
1 answer

FileObserver doesn't work for proc directory

I use FileObserver to monitor '/proc/net/arp' directory,but I can't get any event in onEvent method.The code is below: public class MyFileObserver extends FileObserver{ private Set mListeners; private boolean mWatching =…
pangang
  • 165
  • 1
  • 1
  • 9
0
votes
2 answers

NullPointerException in FileObserver - Android

I am working on FileObserver code now. I have the following code and if I run it, I am getting the NullPointerException. public class FileModificationService extends Service{ private MyFileObserver fileOb; private static final int MAX_FO =…
nki
  • 192
  • 3
  • 17
0
votes
1 answer

Is it possible to scan folders recursively using MediaScanner

I have a basic question on MediaScanner pls help me in understanding this better. MediaScanner for a folder returns only info about folder that is scanned but not contents of a folder for any media files present in it. If a folder is scanned for ex.…
Manju
  • 677
  • 5
  • 13
  • 27
1 2 3
8
9