Android Gallery is conditionally using .nomedia - android

Using stock Android 6.0 (Marshmallow), the stock (LG V10) gallery application (version 4.72.6) is including pictures and other files that have a timestamp newer than the .nomedia file timestamp. I have not been able to test this on other devices to see if it is LG specific.
Recreating the .nomedia file will update the timestamp, and hide all older pictures. Also, the folder being index is a hidden one (starts with a '.'), not sure why it is also being indexed in the first place.
There seem to be a lot of topics on this indexing issue, but none associated with the timestamps. It appears this could have been done intentionally, but it is very undesirable since several applications cannot access the microSD card after the Android permissions update.

Related

Android emulator for android 11 is saving pictures and videos in a different location compared to previous versions

I have a backup app that searches for photos and videos inside sdcard/DCIM and takes backup. Testing it on Android emulator for Android 11. Since android 11 it's saving the pictures and video taken through emulator inside sdcard/Pictures and sdcard/Movies which a new behavior. My app is not able to back it up now. I tried looking for any documentation which suggested this change in android 11 but couldn't find any. Can any of you help me with this if this is the desired behavior going forward?

`adb push` files are not showing on Android 11 Emulator

I am trying to copy photos onto my Android Emulator. I have tried
dragging photos onto the device screen (copying files popup does show up), but the photos do not appear anywhere. This worked on Android 8.1 and 10.
tried adb-pushing photos onto an Android 11 emulator. Although adb-pushed files are present on the file system (on both /sdcard/DCIM and /sdcard/Pictures), they do not show up on the device. I used adb push * /sdcard/DCIM, in a local directory with 24 photos.
I have also tried restarting the emulator (using the restart button on the Android UI), and no images were found. These images still exist on the filesystem. (This rules out me starting an older snapshot)
Unfortunately, the Files app shows these folders to be empty, even after restarting the emulator (Android UI restart button). My method working previously, but for some reason, can't copy photos onto the device now. Does anyone have a better method, or can confirm this method works for them?
Running Android Studio 4.1 (and tried 4.2 Canary) & Android 11.
Since 2 people have upvoted, I wanted to let you know how I work around this. After pushing the files to the device, I always restart it, and wait a couple of the minutes. This allows the MediaStore (which also handles stuff I would say is non-media, e.g. documents) to find the new pictures and add it to its own database.

My File Browser App Doesn't show any files, other than LOST.DIR

I have made an app in Android, which is basically a File Browser. It shows all the files correctly in all devices perfectly, but not in one of my phones - Xperia SL.
It used to work properly in that phone, before I used ASYNC Task to load files asynchronously. After I did that, id doesn't show any file or any folder, just the LOST.DIR folder.
It works in all other phones perfectly, I have tested in 4-5 devices.
Can any one please suggest something?

Some directories not included on File.listfiles() call

In an app I'm working on I have a file manager that uses File.listFiles() to retrieve all the files in a directory. This works perfectly fine on a Samsung Galaxy S3 but on a Nexus 7 tablet with KitKat 4.4.2 some of the directories are missing. The app has permissions to read and write to external storage.
The directories missing are particularly the ones I created recently. I checked the permissions on those and they are the same as the directories that get listed (771). Other file managing apps are able to list them all. Would this be a problem with the system not reindexing the directories?
Is there an alternative to File.listFiles() that would work better?
Obviously the other file managing apps are using a different method since they work fine.
I've tried some suggestions I found online about forcing a media re-scan but all the apps that I tried crash (seems to be an Android 4.4 related issue).
EDIT: I seem to have found the reason, which still puzzles me. There was a call to a function getFileExtension() that was returning NULL and caused some directories to no get listed. The call was done only if the item was not a directory but somehow it affected the execution flow:
if (ff.isDirectory()) {
dir.add(new Option(ff.getName(), "Folder", ff.getAbsolutePath()));
} else {
if (getFileExtension(ff.getName()).matches("WAV|AIFF|AIF|AMB|MP3|OGG|FLAC")) {
fls.add(new Option(ff.getName(), String.valueOf(ff.length()), ff.getAbsolutePath()));
}
}
The funny thing is that the same code ran OK on the Galaxy S3 (with Android 4.3).

How to view Android/data/your.package.name files on external storage in Android 4.2 with the multi user environment?

Android 4.2 added multi user support for tablets. Now when you request a path to save files on external storage via a method like Environment.getExternalStorageDirectory() or Context.getExternalFilesDir(null) you get a value like: /storage/emulated/#/Android/data/your.package.name/ The # being a number depending on what user you are currently logged in as.
This works fine but I have noticed that DDMS's File Explorer and also the Android File Transfer are not able to see these files.
DDMS's File Explorer cannot see anything past storage/emulated/ except an empty legacy folder. File Transfer can see the /Android/data/ folder but for an app running as debug, its files are not visible (but they do exist).
Is there any way to get DDMS or File Transfer to work with these devices? (Hopefully without having to root the device...)
Thanks
Aha!
Try /mnt/shell/emulated/N, for various values of N like 0. That seems to map properly on my Nexus 10 and my Galaxy Nexus in DDMS. I cannot comment on the File Transfer tool, though.
BTW, the numbers are not sequential for the users. So on my N10, the original user is 0, the second user is 10.
As Jelly Bean 4.2 supports multi-user profiles, the sd-card browsing has been changed a bit.
You must have ADT v 21 or higher to browse emulated sd-card.
/mnt/shell/emulated/0 is for default user. See the image attached for more detail.
Enlarge Image

Categories

Resources