Skip to content

Step 1. Set up the integration

Enter the APNs credentials you prepared in Apple Developer in the Hive Console to lay the groundwork for push integration, and install the dedicated plugin to set up the environment for implementing iOS remote push.


1. Set up Apple Developer

In Apple Developer, create the APNs (Apple Push Notification service) credentials to connect to the Hive Axyl push service. For details, see the push settings document in the console guide.

To receive remote push notifications on iOS, you must enable the app's push feature in the Apple Developer Portal and update the provisioning information used to sign builds.

  • Enable the Push Notifications Capability of the App ID in the Apple Developer Portal.
  • After you change the Capability, reissue the Provisioning Profile. With Xcode automatic signing, it is updated automatically; with manual signing, download it yourself.
  • Prepare the certificate or key information to use for sending with APNs.
  • The minimum supported version is iOS 17.0. Check the Target minimum iOS Version in Unity Player Settings.

2. Configure the Hive Console

Register the APNs credentials you created during the Apple Developer setup in the Hive Console so that the Hive Axyl push server can send push messages to iOS devices. For details, see the push settings document in the console guide.

In the Hive Console, enable the APNs push method and register the values needed to send pushes, such as the APNs certificate or key information you prepared in Apple Developer.


3. Install the Hive Axyl APNs plugin

Install the 'APNs plugin' provided by the Hive Axyl SDK.
For iOS remote push, you use the APNs plugin to get a device token issued and to handle messages received while the app is running and notification tap events.

Add the package to the project's dependencies field as in the following example.

"dependencies": {
  "com.hive.axyl.core": "PLACEHOLDER_AXYL_CORE_VERSION",
  "com.hive.axyl.push": "PLACEHOLDER_AXYL_PUSH_VERSION",
  "com.hive.axyl.push.addon.apns": "PLACEHOLDER_AXYL_PUSH_APNS_VERSION"
}

During an iOS build, the plugin automatically handles the following in the generated Xcode project, so the app does not need to add anything.

  • Enabling the Push Notifications capability and writing the aps-environment entitlement
  • Environment branching by build configuration — development (sandbox) for a Unity Development Build, and production for a release build

The plugin's native code links the UserNotifications framework, so you do not need to add a separate dependency. Silent push is not supported, so you do not need to configure Background Modes either.

4. Prepare notification permission and delegate code

The APNs plugin handles token issuance, notification permission requests, notification settings retrieval, and the delivery of received events. The app itself must connect the code that receives the notification events that iOS delivers.

Request notification permission

To display notifications, you must request notification permission (requestAuthorization) from the user. Request the system permission pop-up with RequestAuthorizationAsync() of the APNs plugin, and get the current permission status with GetNotificationSettingsAsync().

using Hive.Axyl.Core;
using Hive.Axyl.Push.Addon.APNS;

IAPNSPlugin apns = HiveCore.Resolve<IAPNSPlugin>();

ApnsServiceRequestAuthorizationResult result =
    await apns.RequestAuthorizationAsync(new[] {
        UNAuthorizationOption.Alert,
        UNAuthorizationOption.Badge,
        UNAuthorizationOption.Sound,
    });

if (result is ApnsServiceRequestAuthorizationResult.Success success)
{
    bool granted = success.Data.Granted;
    // If granted is false, the user has denied notification permission.
}

Permission denial is not a failure; it is handled as Data.Granted == false in Success. If you need the raw current OS permission status, check Data.AuthorizationStatus in the result of GetNotificationSettingsAsync().

Prepare delegate code

The APNs plugin does not install or intercept the app's UIApplicationDelegate/UNUserNotificationCenterDelegate on its behalf. The app must set up its own delegates and call the plugin's Notify* methods directly inside the delegate callbacks. If you do not connect the delegate callbacks, token issuance results and received events do not arrive.

There are four callbacks to connect. Each method takes the data that the OS callback passed (device token, notification object, and so on) as an argument and passes it to the plugin. For signature details, see each reference page.

OS delegate callback Plugin method to call
application(_:didRegisterForRemoteNotificationsWithDeviceToken:) NotifyDidRegisterForRemoteNotificationsAsync(deviceToken) — see APNs token issuance
application(_:didFailToRegisterForRemoteNotificationsWithError:) NotifyDidFailToRegisterAsync(errorDescription) — see APNs token issuance
userNotificationCenter(_:willPresent:withCompletionHandler:) NotifyWillPresentNotificationAsync(notification) — see Push reception handling
userNotificationCenter(_:didReceive:withCompletionHandler:) NotifyDidReceiveResponseAsync(notification, actionIdentifier) — see Push reception handling
Cold start launch options or initial notification response NotifyColdStartNotificationAsync(userInfoJson) — see Push reception handling

The app's application(_:didFinishLaunchingWithOptions:) delegate code also captures the payload when the app is launched by tapping a notification (cold start). Pass the captured original payload JSON with NotifyColdStartNotificationAsync(userInfoJson), and then get it with GetColdStartNotificationAsync() in the app startup flow. For details, see Push reception handling.


Next steps

Implement Step 2. Issue and register tokens.