我试图从首选项中获取URI中的资源mp3文件,并将其设置为Notification to play mp3 Notification sound。但它没有给出错误
obj.setNotificationSound("android.resource://com.packagename.sampleapp/raw/pushsound");
以下是代码: 设置
String setnotificationsound = prefs.getNotificationSound(context);
Uri sound = Uri.parse(setnotificationsound); //Received String as "R.raw.pushsound"
//but getting error (parse (java.lang.string) in URI cannot be applied)
b.setSound(sound);
获得
{{1}}