[問題] Led notification

作者: magic704226 (梅姬?沒雞?傻傻分不清楚)   2016-11-24 23:27:05
忘記到哪一版的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,燈就滅了

Links booklink

Contact Us: admin [ a t ] ucptt.com