Code example for controlling Android LED light color

Source: Internet
Author: User

Many Android mobile phones are equipped with LED lights. For example, HTC mobile phones provide response instructions when charging and sending new text messages. In fact, they are very simple parameters of icationicationmanager, next, Android123 will show you how to use the code to control the flashing of LED lights. Because some models do not have LED lights or have a small number of color types, you need to observe them when releasing them.

Copy codeThe Code is as follows: final int ID_LED = 19871103;
Icationicationmanager nm = (NotificationManager) getSystemService (NOTIFICATION_SERVICE );

Notification notification = new Notification ();
Notification. ledARGB = 0 xFFFFFF; // here is the color. We can try to change it. In theory, 0xFF0000 is red and 0x00FF00 is green.
Notification. ledOnMS = 100;
Notification. ledOffMS = 100;
Notification. flags = Notification. FLAG_SHOW_LIGHTS;
Nm. Y (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.