3
在我的Android應用程序,我有以下代碼:通知不播放聲音或顯示燈,即使設置爲
Notification notification = new Notification(icon, tickerText, when);
context = context.getApplicationContext();
CharSequence contentTitle = "UK Radio Guide";
CharSequence contentText = title + " on " + channel_id + " at " + start;
Intent notificationIntent = new Intent(context, ViewSchedules.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
notification.ledARGB = 0xff00ff00;
notification.ledOnMS = 300;
notification.ledOffMS = 1000;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.sound = Uri.parse("android.resource://com.robinwilson.radioguide/" +R.raw.chimes);
notification.vibrate = new long[] { 0, 300, 200, 300, 400, 300 };
// Actually send the notification
nm.notify(0, notification);
據我所知,我按照文檔中的步驟來設置它從資源文件夾播放聲音,並閃爍燈光。但是,這些都不會發生。然而,它按照指示振動。
任何想法我在做什麼錯在這裏?我已經查看了AndroidManifest.xml文件中的應用程序的權限,但我看不到讓它閃光燈或發出聲音的權限。