Android Tech Help – Customizing LED based Notifications in Android
29 Jul. 2015 Mobile App
LED notifications have made our life easy by letting us know at a glance if we have missed important notifications. But in reality, not all notifications are created equally. Many times we tend to ignore the notification by assuming it is for an email or text. Unfortunately, most Android devices give the same basic notification blink for most types of alerts. This blog explains how you can customize and create LED notification for your Android app.
Android LED Based Notification Customization
Android phones equipped with LEDs, the application should flash different color lights based on notification type and also at different time sequence.
The notification system in Android allows users to remain informed about relevant and timely events on their app. Luckily, there are easy ways to take control of LED notifications by using NotificationManager and Notification class. We can easily assign color codes to the LED light and do more with NotificationManager and instantiate with the NotificationManager class.
First step is to create a Notification class’s object by using ledARGB() method. With this, we can specify the color of the LED light to be displayed on the Android device. You can use the constant ledOnMS to specify the time in milliseconds for which the LED would be on and ledOffMS to specify the time in milliseconds for which the LED would be off.
You can try the code below for creating LED based notifications:
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification();
notification.ledARGB = 0xff0000ff; // Blue color light flash
notification.ledOnMS = 2000; // LED is on for 2 second
notification.ledOffMS = 500; // LED is off for 0.5 second
notification.flags = Notification.FLAG_SHOW_LIGHTS;
Do you need help with developing quality customized Android Apps for your business? Check out our Android App Development Services here.
You can also take a look at a few Android solutions deployed for our enterprise clients: