Turning on the android notification RGB LED

Hi Guys. I’m looking for a code that turn on the android notification LED in red or green or blue or mix between them. Do you know how to code that?

Hi @juanjoc
Does that mean that you can turn on and also off the notification led?
I didn’t even manage to turn it off.
The code below will turn on the notification led, but changing the color parameter does not have any effect on my Samsung S4 Lollipop. (Of course, having the notification enabled in settings and when the screen is off)
How did you manage to turn it off?
Of course, if you use the blink once flag ( FLAG_ONLY_ALERT_ONCE ) it will be turned off, but that is not what I want.

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.support.v4.app.NotificationCompat;
Activity act;
Context context;

int start_time, LED_NOTIFICATION_ID = 0;

void setup () {
  act = this.getActivity();
  context = act.getApplicationContext();
  start_time = millis();
  notificatioLight();
}

void draw() {
  if (millis()-start_time > 5000) {
    act.runOnUiThread(new Runnable() { 
      public void run() { 
        NotificationManager nm = (NotificationManager) 
          act.getSystemService (context.NOTIFICATION_SERVICE);
        nm.cancel(LED_NOTIFICATION_ID);
      }
    }
    );
  }
}

void notificatioLight() {
  NotificationManager nm = (NotificationManager) 
    act.getSystemService(context.NOTIFICATION_SERVICE );
  Notification notif = new Notification();
  notif.flags = Notification.FLAG_SHOW_LIGHTS;
  notif.ledARGB = 0xff0000ff;
  notif.ledOnMS = 100;
  notif.ledOffMS = 100;
  nm.notify(LED_NOTIFICATION_ID, notif);
}

Rectification!!
Now I found out that the code does actually work, but not the way I expected.
It does not stop blinking within the given blink timer but if you press the home button you will see that it will not be “reactivated” after this time. Even better thus. Also, the colors will change with the modification of the parameter. It also overrides the device native notification like for instance, a red led when charging. Please let me know it if it works for you, and on what device, with which android version so that I can upload it on GitHub here.