Register or Unregister Push (RegisterPush/UnregisterPush)
[Player Network SDK & MSDK] Register Firebase channel push notifications to receive messages from the Firebase channel. Bind an account to a registered device so that the game can push notifications to the specified account in the background.
Supported platforms
- Unity
- Unreal Engine
Supports
Android, iOS platform.Supports
Android, iOS platform.Function Definition
- Unity
- Unreal Engine
// Register push notification
void RegisterPush(string channel, string account = "");
// Unregister push notification
void UnregisterPush(string channel);
// Register push notification
static void RegisterPush(const std::string &channel, const std::string &account = "");
// Unregister push notification
static void UnregisterPush(const std::string &channel);
Input Parameters
- Unity
- Unreal Engine
| Parameters | Type | Description |
|---|---|---|
| channel | string | Channel Definition "Firebase" |
| account | string | Bound account Once bound, push messages can be sent to the account; account cannot be single characters like “2”, “a” |
| Parameters | Type | Description |
|---|---|---|
| channel | std::string | Channel Definition "Firebase" |
| account | std::string | Bound account Once bound, push messages can be sent to the account; account cannot be single characters like “2”, “a” |
Callback Handling
The callback handler interface is GUAPushBaseResultObserver.The callback data structure is GUABaseResult.
- Unity
- Unreal Engine
The callback event is PushBaseResultEvents. The callback IDs are GUA_PUSH_REGISTER and GUA_PUSH_UNREGISTER.
The callback event is OnPushOptNotify. The callback IDs are kMethodIDPushRegister and kMethodIDPushUnregister.
Code Example
- Unity
- Unreal Engine
// Register push notification
UnionAdapterAPI.GetPushService().RegisterPush("Firebase");
// Unregister push notification
UnionAdapterAPI.GetPushService().UnregisterPush("Firebase");
// Register push notification
GUA_NAMESPACE::GUAPushService::RegisterPush("Firebase")
// Unregister push notification
GUA_NAMESPACE::GUAPushService::UnregisterPush("Firebase");