views:

466

answers:

2

Hi all

Anyone knows how to change notification sound by code in android. I have managed to set the default ringtone, but cant find a way to set the notification tone...

I would be thankful for any response, as code example, psudo code or just name of a which part of the sdk i need to use...

+1  A: 

You can control this on a per-Notification basis via the sound field on Notification. Note that I haven't tried this personally, but it's what the docs say.

CommonsWare
so, notifications does not automatically play the default notification tone? I would have to specify it when i create the notification ?
PHP_Jedi
By overall default, notifications play no tone. You can use the defaults field on a Notification to indicate which defaults should be used (e.g., DEFAULT_SOUND). Or, you can override the tone on a per-Notification basis. It is unclear if there is a way to set the default notification tone via code.
CommonsWare
A: 

A good example of how to use the notification bar, configure sounds and leds can be found in this tutorial:

http://www.firstdroid.com/2010/05/09/learn-by-example-using-notification-bar/

Hope it helps, Adrian.

azelez