code example to control the color of an Android LED light _android

Source: Internet
Author: User

Many Android phones are equipped with LED lights, such as HTC's phone charging, new text messages, and so will have a response to the instructions, in fact very simple this is notificationmanager some of the parameters, Below Android123 to everyone to say how to control the flashing of LED lights through code, because some models do not have LED lights or color types less, the need for real machine observation.

Copy Code code as follows:

final int id_led=19871103;
Notificationmanager nm= (Notificationmanager) Getsystemservice (Notification_service);

Notification Notification = new Notification ();
Notification.ledargb = 0xFFFFFF; Here is the color, we can try to change, theoretically 0xff0000 is red, 0x00ff00 is green
NOTIFICATION.LEDONMS = 100;
NOTIFICATION.LEDOFFMS = 100;
Notification.flags = notification.flag_show_lights;
Nm.notify (id_led, notification);
Nm.cancel (id_led);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.