2012-07-25 37 views
10

我写的应用程序,intented更换标准/股的使者。所以我需要为传入消息定义默认铃声。我的意思是传入短信通知铃声。如何获取传入短信的URI当前/默认铃声?

任何人知道如何得到它?

+0

这些链接可能会帮助你http://stackoverflow.com/questions/3387556/incoming-call-dynamically-override-default-ringtone http://stackoverflow.com/questions/2092470/android-detect-which-ringtone -is-实际上扮演的铃声,IsPlaying模块-问题?RQ = 1 – 2012-07-25 13:24:06

回答

10

对于默认的通知声音:

String defaultPath = Settings.System.DEFAULT_NOTIFICATION_URI.getPath(); 
+1

与棉花糖 – 2016-06-21 10:43:19

+0

这里同样不工作,不工作棉花糖起 – sud007 2017-06-05 08:03:35

11

要检索的默认铃声的Ringtone对象,请使用RingtoneManager

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

如果用户更改默认的铃声中提供铃声第三方应用信使,AFAIK你不能,除非第三方应用程序通过ContentProvider公开其铃声访问新的铃声。

2

如果您使用Notification.BuilderNotificationCompact.Builder类,则在构建器上调用setSound(Settings.System.DEFAULT_NOTIFICATION_URI)应该有所斩断。

当系统显示您的通知,将播放默认通知音,用户回升。

1

,帮助我的人是 RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)

+0

与棉花糖不工作 – 2016-06-21 10:42:34