RegisterPush/UnregisterPush
[Player Network SDK & MSDK] Register for Firebase push notifications to receive messages from the Firebase channel. Link an account to the linked device so that the game can push notifications to the specified account in the background.
Supported Platform
- Unity
- Unreal Engine
Supports
Android, iOS platform.Supports
Android, iOS platform.Function Definition
- Unity
- Unreal Engine
// Register push
void RegisterPush(string channel, string account = "");
// Unregister push
void UnregisterPush(string channel);
// Register push
static void RegisterPush(const std::string &channel, const std::string &account = "");
// Unregister push
static void UnregisterPush(const std::string &channel);
Input Parameters
- Unity
- Unreal Engine
| Parameter | Type | Description |
|---|---|---|
| channel | string | The channel to push notifications. "Firebase" |
| account | string | The linked account. Linking enables notifications to be pushed to the specified account. The account value cannot be single characters such as “2” and “a”. |
| Parameter | Type | Description |
|---|---|---|
| channel | std::string | The channel to push notifications. "Firebase"" |
| account | std::string | The linked account. Linking enables notifications to be pushed to the specified account. The account value cannot be single characters such as “2” and “a”. |
Callback Processing
The callback processing API is GUAPushBaseResultObserver. The callback data structure is GUABaseResult.
- Unity
- Unreal Engine
The callback event is PushBaseResultEvents.
The callback methodID is GUA_PUSH_REGISTER,GUA_PUSH_UNREGISTER.
The callback event is OnPushOptNotify.
The callback methodID is kMethodIDPushRegister,kMethodIDPushUnregister.
Code Sample
- Unity
- Unreal Engine
// Register push
UnionAdapterAPI.GetPushService().RegisterPush("Firebase");
// Unregister push
UnionAdapterAPI.GetPushService().UnregisterPush("Firebase");
// Register push
GUA_NAMESPACE::GUAPushService::RegisterPush("Firebase")
// Unregister push
GUA_NAMESPACE::GUAPushService::UnregisterPush("Firebase");