Notification doesn't play sound or show lights even though set to
- by robintw
In my android application I have the following code:
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);
As far as I am aware, I have followed the steps in the documentation to set it to play a sound from the resources folder, and to flash the lights. However, neither of these happen. It does, however, vibrate, as instructed.
Any ideas what I'm doing wrong here? I've looked through the permissions that I can give the app in the AndroidManifest.xml file, but I can't see one for letting it flash the light or make sounds.