Question

Is it possible to define priority for my LED notification in such way that my application will replace already existed LED notification which was set by another application? For example when email is received Gmail client will set white-blink LED notification, so when my app trying to set another notification, for example green-persistent the system is ignoring it until first is gone. Is it possible to change system's behavior to show my LED notification in first place? I know that in API 16 was introduced a "priority" flag, but looks like it doesn't change the order of notifications....

Was it helpful?

Solution

No, the priority doesn't affect the LED. Maybe it should, but today the LED follows this algorithm:

  1. When a notification N1 comes in that wants to set the LED (with FLAG_SHOW_LIGHTS):

    a) If there are no other active notifications requesting an LED, the LED is attached to N1 until N1 is canceled (or updated to remove its LED flags).

    b) If the LED is already in use by another notification, N1 goes to the front (!) of the lights queue.

  2. When a notification using the LED is canceled, the notification at the front of the lights queue is given control of the LED until it is canceled (or updated to remove its LED flags).

So it's last-in-first-out, but sticky (i.e. whatever has the LED keeps it until it's gone).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top