Notification to play sound

by droozen » Fri, 13 Mar 2009 01:10:04 GMT


Sponsored Links
 So I've set up my app to have a repeating alarm, daily, as the user
decides, using AlarmManager. I want the user to select a ringtone for
it. This works fine, too. I store the string of the Uri they selected
in a preference to pull it back when my alarm gets run. To pull it
back, I do this:

NotificationManager notifManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
Notification notif = new Notification(-notification stuff-);
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
String reminderSound = settings.getString(getString
(R.string.RingtoneReminder), null);
if(reminderSound != null){
        notif.sound = Uri.parse(reminderSound);
}

So I set the Notification's sound field to the Uri of my notification.
Later, when I call the notifManager.notify(rowId, notif), the
notification still pops up, but the sound doesn't play.

How do I get the sound to play?
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Services - best way to bind

When using AIDL-based async services I've seen various examples when
the service is bound/unbound on Activity's oncreate/ondestroy, onstart/
onstop and even on onpause/onresume. Which one is "right"? And what is
acceptable recovery strategy when attempt using the service fails?

Thanks you for your suggestions
--~--~---------~--~----~------------~-------~--~----~

2. TextView Line Breaks

I am trying to insert line breaks into a string resource so they
appear in a TextView. I put in "\\n" but all I get is "\n" appearing.
Is there a setting I'm missing?

Rud

--~--~---------~--~----~------------~-------~--~----~

3. How to reboot Android Dev Phone into recovery mode?

4. Getting "failed to copy 'content' to '/sdcard/content': Read only file system on donut compilation.

5. Register as a team

6. Who is responsible for validation of layout xml file?

7. H.263 video Codec supported???