phonegap アプリでカスタム サウンドの正しい URI を設定しようとしています。以下を含むいくつかの組み合わせを試しましたが、Uri cannot be resolved
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 を設定するにはどうすればよいですか
より詳しい情報
このチュートリアルを最後に使用して、プッシュメッセージから通知を追加する方法を説明しています....
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
、カスタムサウンドが配置されると思いました。