this works for me, in a BroadcastReceiver for an Alarm :

package com.deepdroid.app.onetask;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;

public class OneTaskAlarm extends BroadcastReceiver {

        public static final int NOTIFICATION_ID = 1;

        @Override
        public void onReceive(Context context, Intent intent) {
                SharedPreferences prefs = 
context.getSharedPreferences("OneTask",
Context.MODE_PRIVATE);
                String taskText = prefs.getString("task", "");
                Notification n = new Notification(R.drawable.onetask_icon, 
taskText,
System.currentTimeMillis());
                String expandedtitle = context.getString(R.string.one_task);
                String expandedtext = context.getString(R.string.task) + " " +
taskText;
                intent = new Intent(context, OneTask.class);
                PendingIntent sender = PendingIntent.getActivity(context, 0, 
intent,
0);
                n.setLatestEventInfo(context, expandedtitle, expandedtext, 
sender);
                n.defaults=Notification.DEFAULT_SOUND;
                n.flags = Notification.FLAG_AUTO_CANCEL |
Notification.FLAG_SHOW_LIGHTS;
                n.ledARGB = Color.GREEN;
                n.ledOffMS = 400;
                n.ledOnMS = 300;
                NotificationManager nm = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
                nm.notify(NOTIFICATION_ID, n);
        }
}

--
http://www.deepdroid.com


On 16 Jun., 04:48, Beth Mezias <[email protected]> wrote:
> Hello good people,
> Has anybody got an LED notification from the notification manager working?
>  I tried using a custom setup as well as using the DEFAULT_LIGHTS setting
> but I see nothing in the emulator nor on the device.  The log shows the
> method is executing the code inside my if.  Here's some code I tried:
>      if (prefs.getBoolean(ctxt.getString(R.string.led), false)) {
>
>      //notification.defaults |= Notification.DEFAULT_LIGHTS;
>                 // when default did not work I tried these settings
>      notification.ledARGB = 0xff00ff00;
>      notification.ledOnMS = 3000;
>      notification.ledOffMS = 1000;
>      notification.flags |= Notification.FLAG_SHOW_LIGHTS;
>                 }
>
> If you have it going can you send me a snippet with your working settings?
>
> Thanks and regards,
> Beth
>
> --
>
> W. C. Fields <http://www.brainyquote.com/quotes/authors/w/w_c_fields.html>
> - "If I had to live my life over, I'd live over a saloon."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to