Notification doesn't play sound or show lights even though set to

Posted by robintw on Stack Overflow See other posts from Stack Overflow or by robintw
Published on 2010-04-25T20:56:13Z Indexed on 2010/04/26 5:03 UTC
Read the original article Hit count: 373

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about android

Related posts about notifications