开发者

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.

  • The customer has indeed installed the update. Confirmed by the server receiving a new versionCode (originally from AndroidManifest.xml) and the app telling the user he is up to date. (this is not a market app)
  • The sound comes from a BroadcastReceiver which is triggered by the Alarm Manager
  • I have tested on the emulator using the same download link from the same server and I can't recreate.
  • The customer's sound "is nothing that resembles a beep". If you listen to Instance.mp3, you will know, it is clearly 5 beeps with about a quarter second between beeps.

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜