700 Software
700 Software

Reputation: 87763

Android Notification sound defaulting back instead of playing custom sound

Has anybody experienced this? I use notification.sound to set a custom sound and a phone still uses the default sound.

I copied a sound from audio-resources.zip/audio/alarms/Instance.mp3. (You can download audio-resources.zip here). I copied it and moved/renamed it to res/raw/notification.mp3.

I am using this code to make the sound.

//Old way: notification.defaults |= Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.sound = Uri.parse("android.resource://my.package.name/raw/notification");

That commented out line is what I was using. It made a sound, presumably the default notification sound. The other two lines are what I am using now.

The old way did not make a sound on the emulator, but it made a sound on the customer's phone (expected). The new way made the correct sound on the emulator, but the customer still hears the old sound.

Now the crazy thing about this is that I would expect the sound to be missing entirely, not to fail back to the default???

I will have the customer reboot his phone and do another clean test (which he has probably already done), but I don't have any more ideas. Do you have any?

Upvotes: 3

Views: 5765

Answers (1)

700 Software
700 Software

Reputation: 87763

Item resolved after rebooting the phone. Don't know why. It was not needed on the emulator. I guess the alarms sitting out there during the upgrade was not helpful.

Upvotes: 1

Related Questions