[問題] Led notification

看板AndroidDev作者 (梅姬?沒雞?傻傻分不清楚)時間9年前 (2016/11/24 23:27), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
忘記到哪一版的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,燈就滅了 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.227.21.133 ※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1480001230.A.33F.html
文章代碼(AID): #1ODmREC_ (AndroidDev)