registerReceiver(this.screenOnListener, new IntentFilter("android.intent.action.SCREEN_ON"));
registerReceiver(this.screenOffListener, new IntentFilter("android.intent.action.SCREEN_OFF"));
https://stackoverflow.com/questions/10402686/how-to-have-led-light-notification
public class ScreenOffListener extends BroadcastReceiver
{
public ScreenOffListener() {}
public void onReceive(Context paramContext, Intent paramIntent)
{
Notification notif = new Notification();
notif.ledARGB = "0xFFFF0000"; // Red
notif.flags = Notification.FLAG_SHOW_LIGHTS;
notif.ledOnMS = 200;
notif.ledOffMS = 200;
nm.notify(NOTIFICATION_ID, notif);
}
}
public class ScreenOnListener extends BroadcastReceiver
{
public ScreenOnListener() {}
public void onReceive(Context paramContext, Intent paramIntent)
{
NotificationTest.nm.cancel(NOTIFICATION_ID);
}
}