Android Notification LED sample

Note : You should lock(screen) the phone before run this project(via android IDE) , because notification LED will be highlighted only when screen is off

Source SVN:LEDNotification
Zipped Source:LEDNotification
 
  public class LEDNotification extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

  NotificationManager notif = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

  for (int i = 0; i < 8; i++) {
   notif.cancel(1); // clear previous notification 
   final Notification notification = new Notification();
   if (i == 0){
    notification.ledARGB = Color.MAGENTA;
   }else if (i == 1){
    notification.ledARGB = Color.BLUE;
   }else if (i == 2){
    notification.ledARGB = Color.CYAN;
   }else if (i == 3){
    notification.ledARGB = Color.GRAY;
   }else if (i == 4){
    notification.ledARGB = Color.GREEN;
   }else if (i == 5){
    notification.ledARGB = Color.RED;
   }else if (i == 6){
    notification.ledARGB = Color.WHITE;
   }else if (i == 7){
    notification.ledARGB = Color.YELLOW;
   }
   notification.ledOnMS = 1000;
   notification.flags |= Notification.FLAG_SHOW_LIGHTS;
   notif.notify(1, notification);
   try {
    Thread.sleep(1000);
   } catch (InterruptedException e) {    
    e.printStackTrace();
   }
  }

 }

 

} 
No Special permission required for this project (LED Notification)

5 comments :

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving... very specific nice content.Android Training institute in chennai with placement | Android Training in chennai |Android Training in Velachery | android development course fees in chennai

    ReplyDelete
  3. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.

    Android Training in chennai | Android Training|Android Training in chennai with placement | Android Training in velachery

    ReplyDelete
  4. Good and nice one, thanks for your valuable information and time, it is very useful for me to learn and study.
    Android Training in chennai|Android Training institute in chennai

    ReplyDelete