本文介绍了如何获取当前的铃声在Android中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现很多的例子如何得到默认铃声。类似的东西:
I have found lots of examples how to get default ringtone. Something like that:
Uri alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
Ringtone ringtone = RingtoneManager.getRingtone(getApplicationContext(), alert);
ringtone.setStreamType(AudioManager.STREAM_RING);
ringtone.play();
不过,我想要得到的实际电流的铃声,这是由用户设定。
But I want to get the actual current ringtone, that was set by the user.
推荐答案
我在这个问题挣扎一样,所以解决的办法是:
I was struggling with this issue as well, so the solution is:
Uri defaultRintoneUri = RingtoneManager.getActualDefaultRingtoneUri(getActivity().getApplicationContext(), RingtoneManager.TYPE_RINGTONE);
Ringtone defaultRingtone = RingtoneManager.getRingtone(getActivity(), defaultRintoneUri);
这篇关于如何获取当前的铃声在Android中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!