Notification on android device disappears

大城市里の小女人 提交于 2019-12-14 02:55:35

问题


So I've noticed on my android device (Marshmallow) that a new email (Gmail) notification goes away if I view the new email in my desktop. Same goes for WhatsApp messages. I was just wondering how this is implemented.

Obviously tried Googling this, but all I found was on Clearing the notifications or disabling them.


回答1:


The application is calling a servlet to see if there are any new/unread messages via a background service. When you view the message on your PC, the service is updated with how there are no longer any unread messages. With this update, the background service in the app sees that there are not any unread messages, so it cancels the notification by its ID with the NotificationManager.



来源:https://stackoverflow.com/questions/38464684/notification-on-android-device-disappears

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!