0
我正嘗試在phonegap應用程序中爲自定義聲音設置正確的URI。我嘗試了好幾種的組合,包括以下但我不斷收到一個Uri cannot be resolved
設置phonegap的通知URI
notif.sound = Uri.parse("android.resource://package_name/raw/notification/alarm.WAV");
notif.sound = Uri.parse("android.resource://package_name/raw/notification/");
notif.sound = Uri.parse("file://path/to/file/alarm.WAV");
如何使用PhoneGap的
當我設置的URI健全更多信息
我使用this tutorial在其結尾部分解釋如何添加來自推送消息的通知....
String message = extras.getString("message");
String title = extras.getString("title");
Notification notif = new Notification(android.R.drawable.btn_star_big_on, message, System.currentTimeMillis());
notif.flags = Notification.FLAG_AUTO_CANCEL;
notif.defaults |= Notification.DEFAULT_SOUND;
notif.defaults |= Notification.DEFAULT_VIBRATE;
Intent notificationIntent = new Intent(context, TestSampleApp.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notif.setLatestEventInfo(context, title, message, contentIntent);
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager)
context.getSystemService(ns);
mNotificationManager.notify(1, notif);
我認爲刪除Notification.DEFAULT_SOUND;
和添加uri
將使它發出一個自定義的聲音。
這是來自推送插件內的java – maxum 2013-05-02 03:24:54
你正在編寫自己的插件嗎?我需要看到更多的代碼,我真的不知道'notif'對象是什麼。 – MBillau 2013-05-02 14:34:31
道歉更多信息的問題 – maxum 2013-05-03 04:13:30