概要
Push API¶
The push notification system receives API requests, forwards the data to the messaging services provided by each OS and platform (APNs, FCM, and ADM), and sends push notifications. The overall flow is shown below.
Messaging services by platform
- APNs (Apple Push Notification service): Apple's push notification service
Apple documentation - FCM (Firebase Cloud Messaging): Google's push notification service for Android
Firebase documentation - ADM (Amazon Device Messaging): Amazon's push notification service
Amazon documentation
The push notification system finds token data that matches the request criteria, builds the payload, and forwards it to the appropriate messaging service. The messaging service then delivers the push message to the device. In other words, the push notification system tracks whether the service call succeeds, but it cannot determine why a message was not received by a device.
Tip
APNs provides separate endpoints for app build and distribution environments (Production and Sandbox).
- Production: api.push.apple.com
- Sandbox: api.sandbox.push.apple.com
Device tokens issued in the APNs Production and Sandbox environments are valid only with the endpoint for the environment in which they were issued. They cannot be used in the other environment. For details, see Apple documentation.
エンドポイント選択ポリシー¶
Hive SDK v4 26.1.0 and later includes the app's build environment (buildType) when registering an APNs token. The push notification system uses this value to select the endpoint.
| buildType | Endpoint |
|---|---|
development | Sandbox |
Any value other than development (such as production or unknown) | Production |
| Not provided (Hive SDK earlier than v4 26.1.0) | Based on the service type of the App ID registered in AppCenter Sandbox for service type TEST; Production for all other types |
AppCenter service type
Sandbox tokens are issued only in Xcode development builds, where buildType is always correctly provided as development. Therefore, every value other than development is treated as a Production token without exception.
When a token includes buildType, the AppCenter service type setting is not consulted. As a result, even if an app's AppCenter service type is TEST, tokens with a value other than development are sent through the Production endpoint.
buildType by Build Method¶
Hive SDK determines the build environment by reading the aps-environment value from the embedded.mobileprovision file in the app package. For apps distributed through TestFlight or the App Store, Apple's re-signing process removes this provisioning profile. Hive SDK cannot access the file in these cases and therefore sends unknown.
| Build method | Actual aps-environment | buildType | Endpoint |
|---|---|---|---|
| Xcode development build | development | development | Sandbox |
| Ad Hoc | production | production | Production |
| TestFlight | production | unknown | Production |
| App Store | production | unknown | Production |
unknown means that the build environment could not be determined. TestFlight and App Store builds in this situation are both signed for the Production environment, so sending tokens marked unknown to the Production endpoint is expected behavior.
環境別 URL¶
| Server | URL |
|---|---|
| Production | https://notification.withhive.com https://notification.qpyou.cn |
| Sandbox | https://sandbox-notification.withhive.com https://sandbox-notification.qpyou.cn |
