[iOS]Push Notification on iOS(1)

Push Notification on iOS

Brief Flow

  • Send Notification request to APNs
  • APNs delivers the notification to target Devices(APPs)
  • APNs will retry later if device power off.

Pushing remote notifications from multiple providers to multiple devices

Establishing certificate-based provider connection trust

Establishing and using token-based provider connection trust

Establishing connection trust between a device and APNs

Managing the device token

Remote notification path from provider to device

Provider Server

  • Device tokens from APNs

  • Build and sent notification request to APNs

  • JSON

  • Schedule Task

  • Certificate

    For security, APNs requires you to refresh your token regularly. Refresh your token no more than once every 20 minutes and no less than once every 60 minutes. APNs rejects any request whose token contains a timestamp that is more than one hour old. Similarly, APNs reports an error if you recreate your tokens more than once every 20 minutes.
    On your provider server, set up a recurring task to recreate your token with a current timestamp. Encrypt the token again and attach it to subsequent notification requests.

    Provider certificates are valid for a year and must be updated to continue communicating with APNs.

  • Implementation

  • Setting Up a Remote Notification Server

APNs (Apple Push Notification service)

Client App (Remote Notification)

  • Enable Push Notification (Xcode & Apple Account)
  • Register with Apple Push Notification service (APNs) and receive an app-specific device token.
  • Send the device token to your notification provider server.
  • Device Token

APNs can issue a new device token for a variety of reasons:

User installs your app on a new device

User restores device from a backup

User reinstalls the operating system

Other system-defined events

As a result, apps must request the device token at launch time
To protect user privacy, do not use device tokens to identify user devices.

NOTE

The ability of APNs to deliver remote notifications to a nonrunning app requires the app to have been launched at least once.

On an iOS device, if a user force-quits your app using the app multitasking UI, the app does not receive remote notifications until the user relaunches it.

Reference

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章