解雇的iOS远程推送通知 [英] Dismissing iOS push notifications remotely

查看:169
本文介绍了解雇的iOS远程推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的Gmail应用程序适用于iOS能够同时应用程序没有运行接收推送通知(因为大多数电子邮件应用程序一样)。

The Gmail app for iOS is able to receive push notifications while the app is not running (as most email apps do).

然而,它也能够从设备清除所有Gmail推送通知当用户的收件箱中的未读计数变为零,,即使应用程序没有运行

However, it is also able to clear all Gmail push notifications from the device when the unread count of the user's Inbox becomes zero, even if the app is not running.

下面是一个例子序列:
1.在您的Gmail帐户收到新的电子邮件。
2. iOS设备显示新邮件通知。
3.进入Gmail网站和打开邮件(将邮件标记为已读)。
4.在iOS设备上的通知被驳回。

Here is an example sequence: 1. Receive a new email in your Gmail account. 2. The iOS device displays a notification for the new message. 3. Go to the Gmail website and open the message (marking the message as "read"). 4. The notification on the iOS device is dismissed.

注意: [UIApplication的sharedApplication] scheduledLocalNotifications] 只提供本地通知,即iOS应用本身所创建的那些

Note: [[UIApplication sharedApplication] scheduledLocalNotifications] only provides local notifications, i.e. those that were created within the iOS app itself.

至于苹果的<一个href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html\"相对=nofollow>为APNS 描述文件,也没有办法<一href=\"http://stackoverflow.com/questions/19068762/will-ios-launch-my-app-into-the-background-if-it-was-force-quit-by-the-user/19202487#19202487\">remotely启动应用进入后台,有没有办法解雇远程通知。

As far as Apple's documentation for APNS describes, there is no way to remotely launch an app into the background, and there is no way to dismiss a remote notification.

那么,如何Gmail iOS应用程序,使这项工作?

So, how does the Gmail iOS app make this work?

推荐答案

我能推这个有效载荷,采用解析清除所有我的推送通知以及。只要你提供我猜内容可用徽章,你应该能够做同样的。我没有写在AppDelegate中任何其他code,但我也必须把对项目目标推送通知功能

I was able to clear all of my push notifications as well by pushing this payload, using Parse. I'm guessing as long as you supply content-available and badge, you should be able to do the same. I didn't have to write any other code in the AppDelegate, but I did have to turn on push notifications in the projects target capabilities.

curl -X POST \
-H "X-Parse-Application-Id: xxxxxxxxxxx" \
-H "X-Parse-REST-API-Key: xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
       "data": {
         "content-available": "1",
         "badge":"0",
         "sound":""
       },
       "where": {"something":"something_else"}
     }' \
https://api.parse.com/1/push

这篇关于解雇的iOS远程推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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