I listen for notifications like WhatsApp Messages.
But every time a notification comes in the NotificationListenerService fire twice.
Does anyone know this p
This issue happened to me too. My workaround is to use notification's time + (notification's title + notification's text) as two keys.
If time is not older than 1 sec and similar title + text then ignore.
if (Calendar.getInstance().getTimeInMillis() - lastMessageTime < 1000 && lastMessageContent.equalsIgnoreCase(title + text)) {
// Ignore
return;
} else {
lastMessageContent = title + text;
lastMessageTime = Calendar.getInstance().getTimeInMillis();
}
I worked for me but I think it may missed some notification.