忘记到哪一版的SDK后
一定要setSmallIcon(用builder)
code变
Notification.Builder builder = new Notification.Builder(MainActivity.this);
builder.setSmallIcon(R.drawable.icon)
.setPriority(Notification.PRIORITY_HIGH)
.setOngoing(true);
builder.setLights(0xff00ff00, 300, 100);
NotificationManager manager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
manager.notify(1, builder.build());
但这样会在通知bar多了一个空的notification
旧版的code
NotificationManager manager =
(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification= new Notification();
notification.ledARGB = "0xFFFF0000"; // Red
notification.flags = Notification.FLAG_SHOW_LIGHTS;
notification.ledOnMS = 200;
notification.ledOffMS = 200;
manager .notify(NOTIFICATION_ID, notif);
这样并不会有空白的那一个通知
要如何才能在 6.0上 开led灯,又没有空白通知
试过cancel,但cancel,灯就灭了