How to get URI current/default ringtone for incoming SMS?
Asked Answered
K

4

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?

Kaleidoscope answered 25/7, 2012 at 13:6 Comment(1)
these link might help you #3388056 #2092970Chazan
T
10

For default notification sound :

String defaultPath = Settings.System.DEFAULT_NOTIFICATION_URI.getPath(); 
Tedie answered 25/7, 2012 at 13:43 Comment(0)
E
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.

Euboea answered 25/7, 2012 at 14:3 Comment(0)
T
10

For default notification sound :

String defaultPath = Settings.System.DEFAULT_NOTIFICATION_URI.getPath(); 
Tedie answered 25/7, 2012 at 13:43 Comment(0)
S
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.

Salazar answered 5/2, 2013 at 7:15 Comment(0)
S
1

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

Sadducee answered 23/12, 2013 at 21:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.