Android NotificationListenerService onNotificationPosted fire twice

后端 未结 5 954
情深已故
情深已故 2021-01-18 12:35

I listen for notifications like WhatsApp Messages.

But every time a notification comes in the NotificationListenerService fire twice.

Does anyone know this p

5条回答
  •  -上瘾入骨i
    2021-01-18 13:03

    I found something, the second notification always brings null tag, so this is what I did.

    if (sbn.tag != null) {
       // Do something
    } else {
       cancelNotification(statusBarNotification.key)
    }
    

提交回复
热议问题