The Gmail app for iOS is able to receive push notifications while the app is not running (as most email apps do).
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.
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.
Note: [[UIApplication sharedApplication] scheduledLocalNotifications]
only provides local notifications, i.e. those that were created within the iOS app itself.
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.
So, how does the Gmail iOS app make this work?