Skip to content

Push module

This module manages, on the Hive Axyl server, the device tokens used to receive remote push notifications. It provides device token registration, changes to the token language and push notification consent, and detaching the token from the user.

This module does not send push notifications. To send push notifications, the app server uses Send remote push notifications in the Hive Axyl Server API, and the devices whose device tokens you registered with this module receive the notifications.

Module information

Item Value
Package com.com2usplatform.hiveaxyl.push
Namespace Hive.Axyl.Push
Supported platforms All (server API)
Minimum requirements Unity 6000.0+

Provided interfaces

Interface Registration method Description
IPushService AddPush() Device token registration, language change, notification consent change, user detachment

Relationship with push notification Add-ons

Push notification Add-ons handle device token issuance and remote push notification reception, because these tasks require calling Firebase Cloud Messaging or Apple's notification framework directly on the device. This module handles registering the issued tokens with the Hive Axyl server and managing them. Add-ons do not register tokens with the Hive Axyl server automatically, so register the tokens you get from an Add-on with UpsertTokenAsync of this module.

Platform Push service Add-on to use together
Android Firebase Cloud Messaging (FCM) Firebase Cloud Messaging push notification Add-on
iOS, macOS Apple Push Notification service (APNs) Apple Push Notification service push notification Add-on

The Apple local push notification Add-on, which schedules local push notifications on macOS, does not go through the Hive Axyl server, so you do not need to use it together with this module.

Registration and retrieval

Register the module with AddPush() in the registration step of HiveBootstrap.Initialize, and then retrieve it with HiveCore.Resolve<T>().

using Hive.Axyl.Core;
using Hive.Axyl.Core.Unity;   // HiveBootstrap
using Hive.Axyl.Push;

var config = CoreConfig.CreateBuilder("{appId}").Build();

HiveBootstrap.Initialize(config, builder =>
{
    builder.AddPush();
});

IPushService push = HiveCore.Resolve<IPushService>();

Every method of IPushService requires a login session. Because the server identifies the user by the authentication token of the login session, log in with the Auth module and register the session before you call them.