In my Android app, 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 };
nm.notify(0, notification);
As far as I know, I followed the steps in the documentation to configure the sound from the resource folder to play and the indicators blink. However, none of this happens. It vibrates, however, as indicated.
Any ideas what I'm doing wrong here? I looked at the permissions that I can grant for the application in the AndroidManifest.xml file, but I do not see it so that it can light up or make sounds.
source
share