I have a FileObserver observing ALL_EVENTS (for test purpose) on a folder in the external storage.
The FileObserver will trigger for any events originating from the tablet. For example, if my application or another application on the tablet creates a file in this folder, it works fine.
However, on the newer Marshmallow system, when copying files with MTP nothing is triggered. Same if I copy files with the shell. Everything used to work on our previous Lollipop system.
Any idea why this would happen?
Related
I have an android app running on Chromebooks. I'm using FileObserver to watch a few common directories and notify changes. This is successful in all locations except the downloads directory on my chromebook.
Downloads directory on this specific chromebook is /storage/MyFiles/Downloads. Do chrombook downloads directories have special protections? (are we not allowed to monitor there?)
If this is a security issue or otherwise intentional and you have a source, please share it
This is how the device filesystem looks in AS:
App requests permission from the user upon start and it automatically restarts for that specific OS only. That works properly for the app to detect OBB file. But our game has a downloader system that pulls the files from internet to unlock more levels and it seems like I have to restart the app every time a file has been downloaded for the app to recognize it..any clue?
Yes, indeed the files download (zip files) but the unzipped folders are empty when attempting an unzip. The folders should have media in them. For Android OS 6.0 marshmallow.
I've got an application which writes large files to an external USB drive. The directory to write these files to comes from context.getExternalMediaDirs(), so it normally ends up being something like /storage/<UUID>/Android/media/com.app.package/.
My problem is that on all devices I've tested so far, this works. However, on a Sony Bravia TV (running Android 8.0) I am able to create files in the external media directory, but if I call mkdirs() to create a directory it always returns false.
My application targets API 28, declares the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions, and requests them both from the user at runtime.
It also seems that this problem goes away if I allow the Sony TV to "format the device as external storage", however this formats it to FAT32 which imposes file size limits that are unacceptable for my application.
Formatting the drive to NTFS via a PC allows files to be created, but not directories.
I suspect this is indicative of a bug in Sony's implementation, but I'd like some feedback from the community.
Has anyone encountered this on other devices? Is there a potential work around?
It doesn't make sense to me that I'd be allowed to create a file, but not a directory.
I am writing several files to a directory on the SD card, creating some and overwriting others. My tablet is connected to my Windows laptop, where I am looking at this directory and opening those files. In my Android app, after closing each file, I make sure to call MediaScannerConnection.scanFile(). This ensures that all the new files show up immediately, but somehow the overwritten files still seem to retain their original content--this is, until I unplug the USB cable and plug it back in.
This is on an Acer Iconia A500 running ICS.
Why isn't it working, and how do I fix it?
I am having very Strange problem with my Samsung Nexus with Android 4.0.2. I wrote a simple program which basically create file each time user presses a button. My program is working great on other devices where as on Galaxy Nexus Windows/Mac can not see those files on SD card, but when i do adb shell i see all files on SD Card.
I retest this on another Nexus which has Android 4.0.4 but still same result.
What could be the reason?
You probably need to index your files via MediaScannerConnection. Quoting myself from a blog post from last year:
...the MTP contents are not based on the literal contents of external storage. Instead, MTP contents are based on what files have been scanned by MediaScannerConnection. If you write a file to external storage, until and unless that file is scanned by MediaScannerConnection, it will not be visible to users over MTP.
External storage is scanned on a reboot and possibly on a periodic basis. Users can manually force a scan via utilities like SDRescan. However, the best answer is for you to use scanFile() on MediaScannerConnection to update the media database after you close your file. This will make your file immediately available to the user.