Home > Technology > Android Media File Madness on the Nexus 4

Android Media File Madness on the Nexus 4

February 10th, 2014 Leave a comment Go to comments
This entry is part 4 of 4 in the series Nexus 4

Background

A few weeks after getting my Nexus 4, I noticed strange behavior with ringtones, notification sounds, and Google Music player. The symptoms of the problem were an odd combination of three basic issues:

  1. Ringtone and notification sound files started appearing in my Google Music player.
  2. The phone would lose custom ringtone and notification sounds after a reboot.
  3. The “Media Browser” wouldn’t see my custom ringtone or notification sound files when I tried to restore them.

The really annoying part of this problem was that it constantly changed and was impossible to recreate with any regularity. By this I mean that if I lost my phone sounds I could sometimes go and restore them via media browser. But other times the files wouldn’t appear in the list. Then if I moved the files from one directory to another they would start to work again, but get lost after a reboot. Then, at times, only some of my notification sounds appeared in lists and others didn’t, even though all the files were in the same directory!

I spent the better part of three hours searching forum posts all over the web and found many similar complaints going all the way back to the Gingerbread days. There were all kinds of conflicting suggestions. For example:

  • Some posts insisted that custom ringtones be put in a /Ringtones directory in the root of the internal SD card (typically /storage/emulated/0/Ringtones). Similarly, they suggested a /Notifications directory for notification sounds.
  • Other posts insisted that the files had to be in a /media/audio/ringtones (or notifications) directory on the SD card.
  • Other posts suggested that one needed a rooted phone and that the files should be dropped in the /system/media/audio/ringtones (or notifications) directory with the stock sound files.
  • As for preventing Google Music Player from indexing the sounds, there was some insistence that a .nomedia file needed to be placed in the ringtones and notifications directories.

What was really killing me is that all of this advice worked and yet none of it did. For example, my files were in the /system/media/audio directories to begin with, when they stopped working properly. I copied them to the /Ringtones and /Notifications directories and they suddenly appeared in my media browser list so I could set them as rings and sounds. But then they started appearing in my Google Music player. So i added a .nomedia file to the directories and most (but not all) of the files disappeared from Google Music (two remained visible) but all disappeared from my custom sound selections and could not be added back by normal means. Then I moved the files back to /media/audio/ringtones or notifications and suddenly they again appeared in the list of available notifications and ringtones, but they also appeared back in Google Music player. I was ready to chuck my phone out of the window.

As is so often the case, forums for Android issues (and for most other technology to be fair) are full of half-baked ideas, wild theories, speculation, and downright wrong advice. After all the conflicting advice I did finally fix my problem. Here’s how.

My Environment

Because all phones and versions of Android are different, your mileage may vary, but unlike most posts I will at least tell you how my phone is configured so you can judge for yourself if it’s similar enough for you to try.

Hardware: Nexus 4, 16GB

OS: Stock KitKat 4.4.2 (KOT49H)

Kernel: Franco 3.4.0 (5 January 2014)

Root: Yes. SuperSU.

The Problem

After all the investigation I concluded that the problem had something to do with the Android media scanner. It was clear that it was scanning after reboots since the files were appearing and disappearing, but something was causing it to no longer follow the rules. Like not indexing files in the ringtones directories for Google Music player. I tried several apps from the Play Store to trigger the scanner but none of the first four I tried worked in KitKat. Some did absolutely nothing. One was so slow it would have taken days to index my phone.

So I decided to start over. That meant wiping the existing data and re-indexing. Here’s how I did it.

The Solution

  1. Decide where you want your files. I don’t think it matters, but since my files were in the /system/media/audio path I left them there.
  2. Wipe out the existing media scanner information by going to: Settings/Apps/All/Media Storage. Click Clear Data.

    ClearMediaCache

    Clear Media Cache

  3. Trigger re-scan of the device. You could just do this by rebooting and waiting for it to finish, but I found an app that works: SD Scanner by Jeremy Erickson worked brilliantly. It’s simple, free, there are no ads, and he makes his source available. He’s my new best friend. Plus it has a progress bar so you know it’s working. Exactly what a simple and great app should be.

    SD Scanner Really Works

    SD Scanner Really Works

And what do you know? It seems to be working. No crap in my Google Music app and my ringtones and notification sounds persist after a reboot (actually several). What a royal pain in the ass, but in the end, not too hard to fix. Good luck. I hope this helps you.

This content is published under the Attribution-Share Alike 3.0 Unported license. Please click link for information.

Series NavigationNew Nexus 4 – Day 2

Post Revisions:

Categories: Technology Tags: ,
  1. No comments yet.
  1. No trackbacks yet.