10

I am writing application which intented to replace standard/stock messenger. So I need to define default ringtone for incoming messages. I mean incoming SMS notification ringtone.

Anyone knows how to get it?

Barmaley
  • 16,638
  • 18
  • 73
  • 146
  • these link might help you http://stackoverflow.com/questions/3387556/incoming-call-dynamically-override-default-ringtone http://stackoverflow.com/questions/2092470/android-detect-which-ringtone-is-actually-playing-ringtone-isplaying-problem?rq=1 – Avi Kumar Jul 25 '12 at 13:24

4 Answers4

11

To retrieve the Ringtone object of the default ringtone, use the RingtoneManager:

Ringtone ringtone = RingtoneManager.getRingtone(context, Settings.System.DEFAULT_RINGTONE_URI);

If the user has changed the default ringtone to a ringtone provided in a 3rd party messager app, AFAIK you can't access the new ringtone unless the 3rd party app exposes its ringtones via a ContentProvider.

Gunnar Karlsson
  • 28,350
  • 10
  • 68
  • 71
10

For default notification sound :

String defaultPath = Settings.System.DEFAULT_NOTIFICATION_URI.getPath(); 
Paramvir Singh
  • 2,354
  • 1
  • 20
  • 20
2

If you are using the Notification.Builder or NotificationCompact.Builder classes, calling setSound(Settings.System.DEFAULT_NOTIFICATION_URI) on the builder should do the trick.

That will play the default Notification tone that the user has picked when the system displays your notification.

Jeshurun
  • 22,940
  • 6
  • 79
  • 92
1

The one that helped me is RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION).

chappjc
  • 30,359
  • 6
  • 75
  • 132
Naren
  • 2,706
  • 1
  • 21
  • 15