从通知中心移除远程通知 [英] Remove remote notification from Notification Center
问题描述
如果您在别处查看通知,某些应用程序,特别是 StackExchange 应用程序和 Facebook 能够从通知中心/锁屏中删除通知.例如,如果我从堆栈交换收到收件箱通知,然后在我的笔记本电脑上查看我的收件箱,通知几乎立即从我的手机上消失.最初我认为这是 Apple 可以通过 Mail 和 Facebook 做到的事情.
Some apps, specifically the StackExchange app and facebook are able to remove notifications from the Notification Center/Lockscreen if you view the notification elsewhere. For example if I get an inbox notification from stack exchange and then view my inbox on my laptop the notification disappears almost immediately from my phone. Originally I thought this was something just Apple could do with Mail and Facebook.
StackExchange 如何向手机发送通知以删除现有通知?
How does StackExchange send a notification to the phone to remove an existing notification?
推荐答案
我认为他们所做的就是发送一个标记编号为0"的通知,以从通知中心清除所有现有的通知.我在 Gmail 应用程序上注意到了相同的行为,因此我对其进行了一些小型研究:
I think that what they do is to send a notification with a badge number of '0' to clear all the existing ones from the notification center. I have noticed the same behavior on the Gmail app, so I did some small research about it:
当我发送一封电子邮件时,我会在手机上收到推送通知.然后我从笔记本电脑的浏览器打开那封电子邮件,通知中心立刻就清晰了.
When I send one email, I receive a push notification on my phone. Then I open that email from my laptop's browser, and straight away the notification center is clear.
当我发送两封电子邮件时,我会收到两个推送通知.然后,当我在笔记本电脑上打开第一个通知时,两个通知仍然保留在我的 iPhone 上.在我打开第二封电子邮件(仍在我的笔记本电脑上)后,通知中心被清除.
When I send two emails, I receive two push notifications. Then, when I open the first one on my laptop, both notifications still remain on my iPhone. After I open the second email (still on my laptop) the notification center gets cleared.
我对 Wireshark 进行了一些额外检查,我认为每次我在笔记本电脑上打开电子邮件时,Google 都会向我的手机发送推送通知(即使我的收件箱中仍有未读邮件).
I did some extra checks with Wireshark and I think that every time that I open an email on my laptop, Google sends a push notification to my phone (even if there are still unread messages in my inbox).
在上述所有情况下,gmail 应用未运行(但我不确定 iOS 7 中引入的后台提取是否会使事情复杂化).
In all the above cases, the gmail app was not running (however I'm not sure if the background fetch introduced on iOS 7 can complicate things).
希望能帮到你!
这篇关于从通知中心移除远程通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!