播放默认通知声音

/**

* 播放系统默认提示音

*

* @return MediaPlayer对象

*

* @throws Exception

*/

public void defaultMediaPlayer() throws Exception {

Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

Ringtone r = RingtoneManager.getRingtone(mContext, notification);

r.play();

}

播放默认来电铃声

/**

* 播放系统默认来电铃声

*

* @return MediaPlayer对象

*

* @throws Exception

*/

public void defaultCallMediaPlayer() throws Exception {

Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);

Ringtone r = RingtoneManager.getRingtone(mContext, notification);

r.play();

}播放默认闹钟铃声

/**

* 播放系统默认闹钟铃声

*

* @return MediaPlayer对象

*

* @throws Exception

*/

public void defaultAlarmMediaPlayer() throws Exception {

Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);

Ringtone r = RingtoneManager.getRingtone(mContext, notification);

r.play();

}

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐