Changing notification sound

All your problems with Audio, Video and Images.

Changing notification sound

Postby alexm » Wed Jan 19, 2011 2:37 pm

What is the simplest way to change the notification sound. I have the following.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 Notification notification = new Notification(
  2.                                 R.drawable.icon,
  3.                                 contentTitle,
  4.                                 System.currentTimeMillis()
  5.                 );
  6.                 notification.sound = URI
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


But how do I set the URI? Do I have to write a content provider just to give access to the sound file that comes with the app?
alexm
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Jun 22, 2010 7:34 am

Top

Re: Changing notification sound

Postby alexm » Wed Jan 19, 2011 2:51 pm

turned out to be simple enough, just needed to refer to the correct resource

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Uri uri = Uri.parse("android.resource://com.example.app/raw/sound");
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
alexm
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Jun 22, 2010 7:34 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 27 guests