Thursday, March 22, 2012

Android: Prevent Media Scanning of Specific Folders.

After years of owning an Android based phone, my media collection has grown significantly. But something that has always bothered me is ALL visual media is displayed in the gallery, and generally they are items I don't care to see cluttering up my gallery view. Such as album artwork from my mp3 collection, or other graphic images used by other apps on the phone. After doing some research on the Android OS I've found two fix's that work nicely depending on your needs.

Option 1: ".nomedia" file
I like this option for basic stuff like hiding the graphics used by my Battlefield Bad Company Stats app. The downloaded graphics will be hidden from the media scanner but the folders are still visible from the file browser.
  1. Create a nomedia.txt file on a local computer. ( The file does not need to be created on a local computer and could be created within the Android system itself using a file editor, this is just the method I used.)
  2. Copy the newly created file to the directory you would like to "hide" from the media scanner.
  3. On the android system, browse to the directory where you copied your nomedia.txt file.
  4. Long press the nomedia.txt file until you get the context menu.
  5. Select rename
  6. Change the name of the file to ".nomedia"
  7. The directory is now exempt from media scans and will not show in the gallery.
Option 2: Prefixing a directory.
This option is adds a bit more security, by marking the directory as hidden. to achieve this follow the directions below.
  1. Use the My Files or any other file browser and go to the root location of the directory you wish to mark as hidden.
  2. Long press the desired folder until you get the context menu.
  3. Select rename
  4. add a '.' to the beginning of the folder name.
  5. The folder will now be hidden and is exempt from the media scans, therefor not seen by the Gallery.
Quick Note About Security.
Although Option 2 will hide the directory from the media scanner and any non-root file manager, with "Show Hidden Directories" turned off. the data is still accessible by any user of your phone and will be visible and there for browse-able by graphical means.

Or keep it REALLY simple with F-Stop Media Gallery

https://play.google.com/store/apps/details?id=com.fstop.photo