如何设置通知声音? [英] How to set sound for notification?
本文介绍了如何设置通知声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将.mp3文件复制到资产中.收到通知时,文件未播放
I copied the .mp3 file in assets. When notification raises, file is not playing
任何人都可以帮助我.
notification.sound = Uri.parse("file:///android_assets/alarm_951.mp3");
推荐答案
不是将文件复制到资源文件夹,而是将其复制到resources/raw/,然后使用
Instead of copying your file to the assets folder copy it to resources/raw/ and then use
Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.mysound);
mBuilder.setSound(sound);
这篇关于如何设置通知声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文