fileobserver

Observing changes in Android content observer for Audio.Media.EXTERNAL_CONTENT_URI

时光总嘲笑我的痴心妄想 提交于 2019-11-27 02:50:57
问题 I am developing an Android app in which I have to detect changes in Android SD card for audio files with the file name, file path and operation performed upon it. Example if I am adding a file in my SD card then I want to know Name of the file which is added Path of the file Operation -- Add Previously I Have tried file observer But for that I have to apply it on each and every directory. So I searched for some other solution and got the info about Audio.Media.EXTERNAL_CONTENT_URI . Then I

Android: FileObserver monitors only top directory

淺唱寂寞╮ 提交于 2019-11-26 14:05:26
问题 According to the documentation, "Each FileObserver instance monitors a single file or directory. If a directory is monitored, events will be triggered for all files and subdirectories inside the monitored directory." My code goes like, FileObserver fobsv = new FileObserver("/mnt/sdcard/") { @Override public void onEvent(int event, String path) { System.out.println(event+" "+path); } }; fobsv.startWatching(); However, the onEvent() is triggering only when a file is changed in the /mnt/sdcard/