Android设备上的通知消失 [英] Notification on android device disappears

查看:68
本文介绍了Android设备上的通知消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在Android设备(棉花糖)上注意到,如果我在桌面上查看新电子邮件,就会收到新电子邮件(Gmail)的通知. WhatsApp消息也是如此.我只是想知道如何实现.

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.

显然尝试了Google搜索,但是我发现的只是清除通知或禁用通知.

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

推荐答案

应用程序正在调用servlet,以通过后台服务查看是否有任何新消息/未读消息.当您在PC上查看消息时,该服务将更新为不再有任何未读消息.通过此更新,应用程序中的后台服务会看到没有未读消息,因此它将通过NotificationManager的ID取消通知.

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.

这篇关于Android设备上的通知消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆