views:

777

answers:

3

Good day all,

I would like to be able to control the LED on an Android handset with finer grained control than is offered by the Notification class. Notifications allow one to change the rate of flashing; e.g. 300 milliseconds on, 1000 milliseconds off, but that's it.

Essentially, I would like to turn the LED on and off at will at arbitrary times. Does anyone know if this is possible? The API does not seem to say so. Would that require dependence on the actual hardware?

A: 

I haven't tried this in code, but the SDK shows this:

  • To turn the LED off, pass 0 in the alpha channel for colorARGB or 0 for both ledOnMS and ledOffMS.
  • To turn the LED on, pass 1 for ledOnMS and 0 for ledOffMS.
  • To flash the LED, pass the number of milliseconds that it should be on and off to ledOnMS and ledOffMS.

And then you could use NotificationManager.cancel() to arbitrarily turn the notification off.

http://developer.android.com/reference/android/app/Notification.html#FLAG_SHOW_LIGHTS

Will
A: 

that's not an answer to the question : you need a notification object to use this tip...

any other way to control the LED at arbitrary times ?

Guian
This should be a comment, not an answer.
Blixt
A: 

have you find this control method?

Syd