notification自定义铃声

做项目的时候要用到notification的自定义铃声,我是这么写的

messageNotification.sound = Uri.parse("android:resource://"

+ getPackageName() + "/" + R.raw.msg);

关于铃声的设置有好多种方法:

方法一:

 

messageNotification.defaults |= Notification.DEFAULT_SOUND;//声音

 方法二:

messageNotification.sound = Uri.parse("android:resource://"
				+ getPackageName() + "/" + R.raw.msg);

 方法三:

messageNotification.sound = Uri.withAppendedPath(
	 Audio.Media.INTERNAL_CONTENT_URI, "2");// 选音乐清单的第2首歌做消息声音

猜你喜欢

转载自zhonglunshun.iteye.com/blog/2119047