In mobile games, Push Notifications are an important means to maintain and increase user retention. Hive provides Push Notification Services to notify news in diverse ways to users. Not only provides advertisement push notification for marketing to increase retention of game, and also supports Google’s FCM and Apple’s APNS. Language-specific and timezone-specific settings are available to support global services as well.
Push Type
Remote Push
Remote Push is a push sent to the user’s device through Hive console or game server using Hive server API.
There is nothing to implement in your game to receive Remote Push. However, you should call Hive API to check and change the push settings when users intend to see or change settings of Remote Push. View details
Local Push
Local Push is a push sent by Game Client directly to users using Hive API in the game, You can register and release local push using Hive API, and customize push UI for Android devices. View details
Push Settings
The user will see the terms of agreement upon initial game play after the app installs, and will perform the consent process to receive an advertising push for marketing. However, you should provide the function to opt in or out of the service on game settings page for those who do not want to receive push notifications.
Settings Type
It should be available to opt in or out of push notifications for All Notifications, Game Notification, Announcement Notification and Night-time Notification.
All Notifications |
|
Game Notification |
|
Announcement Notification |
|
Night-time Notification |
|
Push Settings Policy
1. Provide a menu for users to activate or deactivate push services in games.
- The composition of Push Settings
- All Notifications is exposed on Android devices and available to comprise details depending on the game features.
- Night-time Notification is exposed to users in Korea only.
- The default value of All Notifications and Game Notification settings are ON.
- The default value of Announcement Notification and Night-time Notification settings are from Hive API.
- Notification setting menu when game language is Korean
(Make sure to display night-time notification settings on all devices including Android and iOS platform) - Notification setting menu when game language is not Korean
- You should display a toast popup for two seconds when push notification settings are changed.
- Expose Notice popups
- when a user logged in from Korea
- when the settings of All Notifications, Notices, Night-time Notifications changed (for Game notification, do not display toast popups)
- Texts for toast popup
- Activate All Notifications: [Company Name] 2016.05.01 You opted in to all notifications.
- Deactivate Announcement Notification: [Company Name] 2016.05.01 You opted out of announcement notification.
- Activate Night-time Notification: [Company Name] 2016.05.01 You opted in to night-time notification.
- An example of toast popup
Provide notification texts for push settings.
In case users do not receive a push, even though users have enabled it in the push settings menu, please provide instructions to check user’s notification settings in the device settings menu. Push notifications are not displayed if users opted out of notifications on device settings.
2. Use Hive API to configure settings for notification sent through Hive Console.
- Hive Console delivers two types of push notification; Announcement Notification and Night-time Notification
- The values of the two notification options must be set to the values set in the Hive server.
- You must pass changes to the Hive server when both notification options change.
- For more information, see Sending Remote Push.
3. Apply the Night-time Notification Policy.
Night-time Notification belongs to Announcement Notification. Please apply the following policies when implementing Night-time Notification settings menu.
- If a user opted out of Announcement Notification, Night-time Notification should be automatically deactivated.
- With deactivated Announcement Notification, Night-time Notification should be unable to activate.
- Even a user opted out of Announcement Notification, Night-time Notification should not be automatically activated.
Push Display Settings
Push notification is generally displayed when your game app is not in use. With Hive SDK v4.9.0, however, push service is available to expose even the app is activated. iOS is supported from iOS 10.
Push settings Class
The following classes show whether push messages are sent or not when the app is activated.
Push settings callback
Implement the following callbacks when calling push settings API to retrieve about the request result.
Set whether to receive push messages on the activated app
Using the following APIs, you can set whether to receive push messages when the app is activated.
API Reference: Push.setForegroundPush
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
using hive; // Remote push settings Boolean useForegroundRemotePush = true; // Local push settings Boolean useForegroundLocalPush = false; PushSetting pushSetting = new PushSetting(useForegroundRemotePush, useForegroundLocalPush); Push.setForegroundPush (pushSetting, (ResultAPI result, PushSetting setting) => { if (result.isSuccess()) { // call successful // setting: Result of whether to display notifications set via API } }); |
API Reference: Push ::setForegroundPush
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; // Remote push settings bool useForegroundRemotePush = true; // Local push settings bool useForegroundLocalPush = false; PushSetting pushSetting(useRemote, useLocal); Push::setForegroundPush(pushSetting, [=](ResultAPI const & result, PushSetting setting) { if (result.isSuccess()) { // call successful // setting: Result of whether to display notifications set via API } }); |
API Reference: Push.setForegroundPush
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import com.hive.Push import com.hive.ResultAPI // Remote push settings val useForegroundRemotePush = true // Local push settings val useForegroundLocalPush = false val pushSetting = Push.PushSetting(useForegroundRemotePush, useForegroundLocalPush) Push.setForegroundPush(pushSetting, object: Push.PushSettingListener{ override fun onPushSetting(result: ResultAPI, pushSetting: Push.PushSetting?) { if (result.isSuccess) { // call successful // pushSetting: Result of notification visibility set via API } } }) |
API Reference: Push.INSTANCE .setForegroundPush
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import com.hive.Push; import com.hive.ResultAPI; // Remote push settings boolean useForegroundRemotePush = true; // Local push settings boolean useForegroundLocalPush = false; Push.PushSetting setting = new Push.PushSetting(useForegroundRemotePush, useForegroundLocalPush); Push.INSTANCE.setForegroundPush(setting, (result, pushSetting) -> { if (result.isSuccess()) { // call successful // pushSetting: Result of notification visibility set via API } }); |
API Reference: Swift
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import HIVEService let pushSetting = PushSetting() // Remote push settings pushSetting.useForegroundRemotePush = true // Local push settings pushSetting.useForegroundLocalPush = false PushInterface.setForegroundPush(pushSetting) { result, setting in if result.isSuccess() { // call successful // setting: Result of whether to display notifications set via API } } |
API Reference: Objective -C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#import <HIVEService/HIVEService-Swift.h> HIVEPushSetting *pushSetting = [[HIVEPushSetting alloc] init]; // Remote push settings pushSetting.useForegroundRemotePush = YES; // Local push settings pushSetting.useForegroundLocalPush = NO; [HIVEPush setForegroundPush: pushSetting handler: ^(HIVEResultAPI *result, HIVEPushSetting *setting) { if ([result isSuccess]) { // call successful // setting: Result of whether to display notifications set via API } }]; |
Search whether receiving push messages on activated app
Using the following APIs, you can search the state whether receiving push messages when the app is activated.
API Reference: Push .getForegroundPush
1 2 3 4 5 6 7 |
using hive; Push.getForegroundPush ((ResultAPI result, PushSetting pushSetting) => { if (result.isSuccess()) { // TODO: Check whether notifications are received using pushSetting } }); |
API Reference: Push ::getForegroundPush
1 2 3 4 5 6 7 8 9 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; Push::getForegroundPush([=](ResultAPI const & result, PushSetting pushSetting) { if (result.isSuccess()) { // TODO: Check whether notifications are received using pushSetting } }); |
API Reference: Kotlin
1 2 3 4 5 6 7 8 9 10 |
import com.hive.Push import com.hive.ResultAPI Push.getForegroundPush(object : Push.PushSettingListener { override fun onPushSetting(result: ResultAPI, pushSetting: Push.PushSetting?) { if (result.isSuccess) { // TODO: Check whether to receive notifications with pushSetting } } }) |
API Reference: Push.INSTANCE .getForegroundPush
1 2 3 4 5 6 7 8 |
import com.hive.Push; import com.hive.ResultAPI; Push.INSTANCE.getForegroundPush((result, pushSetting) -> { if (result.isSuccess()) { //TODO: Check whether notifications are received using pushSetting } }); |
API Reference: PushInterface .getForegroundPush
1 2 3 4 5 6 7 |
import HIVEService PushInterface.getForegroundPush() { result, pushSetting in if result.isSuccess() { // TODO: Check whether notifications are received using pushSetting } } |
API Reference: HIVEPush getForegroundPush
1 2 3 4 5 6 7 |
#import <HIVEService/HIVEService-Swift.h> [HIVEPush getForegroundPush: ^(HIVEResultAPI *result, HIVEPushSetting *pushSetting) { if ([result isSuccess]) { // TODO: Check whether notifications are received using pushSetting } }]; |
Provisional Authorization
Hive SDK v4.11.4 starts to support a new funtion for iOS 12, Provisional Authorization.
As the agreement popup on sending push notification is no more exposed after agreement on terms of service of Hive SDK, users who run your app receive all kinds of push messages as a default. With provisional authorization, all users can select to receive push notifications on the push message or app settings. Default setting is that push messages do not sound nor expose until user manually opts in to push notification even if the user receives the messages.
Devices with earlier than iOS 12 display the agreement popup on sending push notification after initializating Hive as usual.
Request Permission for Prominent Push
From Hive SDK v4.16.2 (Android), you can expose the agreement popup on sending prominent push notification if it’s necessary in game. To expose the agreement popup on sending prominent push notification, call requestPushPermission()
method in Push class before user set whether to agree on sending push notification.
For iOS, even if user agrees on terms of service of Hive SDK through Provisional Authorization, the agreement popup on sending push notification is exposed, and the user can receive the prominent push notification.
For Android, the pop-up is exposed when the target SDK is 33 or higher on Android 13 or higher devices, and when the target SDK is lower than 33, it is exposed when AuthV4.setup()
is called.
Followings are sample codes to expose the agreement popup on sending push notification.
API Reference: hive.Push.requestPushPermission
1 2 3 |
using hive; Push.requestPushPermission(); |
API Reference: Push::requestPushPermission
1 2 3 4 5 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; Push::requestPushPermission(); |
API Reference: Push.requestPushPermission
1 2 3 |
import com.hive.Push Push.requestPushPermission() |
API Reference: Push.INSTANCE.requestPushPermission
1 2 3 |
import com.hive.Push; Push.INSTANCE.requestPushPermission(); |
API Reference: PushInterface.requestPushPermission
1 2 3 |
import HIVEService PushInterface.requestPushPermission() |
API Reference: HIVEPush:: requestPushPermission
1 2 3 |
#import <HIVEService/HIVEService-Swift.h> [HIVEPush requestPushPermission]; |
Push Multi-Language Settings
Language | All Notifications | Game Notification | Announcement Notification |
---|---|---|---|
Korean | 모든 알림 | 게임 알림 | 공지 알림 |
English | All Notifications | Game Notification | Announcement Notification |
Japanese | 全ての通知 | ゲーム通知 | お知らせ通知 |
Chinese (Simplified) | 所有通知 | 游戏通知 | 公告通知 |
Chinese (Traditional) | 所有通知 | 遊戲通知 | 公告通知 |
German | Alle Benachrichtigungen | Spiel-Benachrichtigung | Ankündigungen |
Russian | Все уведомления | Уведомления игры | Объявления |
Malay | Semua notifikasi | Notifikasi permainan | Notifikasi pengumuman |
Vietnamese | Tất cả thông báo | Thông báo game | Thông báo tin tức |
Spanish | Todas las notificaciones | Notificación del Juego | Notificación de Anuncio |
Italian | Tutte le notifiche | Notifiche di gioco | Notifiche degli avvisi |
Indonesian | Semua Notifikasi | Notifikasi Game | Notifikasi Pengumuman |
Thai | การแจ้งเตือนทั้งหมด | การแจ้งเตือนเกม | การแจ้งเตือนประกาศ |
Turkish | Tüm Bildirimler | Oyun Bildirimi | Duyuru Bildirimi |
Portuguese | Todas as notificações | Notificação de Jogo | Notificação de Anúncios |
French | Toutes les notifications | Notification de jeu | Notification d’annonce |
Arabic | كل الإشعارات | إشعارات اللعبة | إشعارات الإخطار |
The push notification and the app icon badge
If you receive a notification on your device, the app icon badge is automatically displayed. The app icon badge is a counter that displays the number of the received notifications for an app on the right upper corner of the app icon. This badge feature can be turned off/on in the device settings or the app configurations. By default, the display of a badge follows the policy below by OS.
- iOS
- The app icon badge is always 1 regardless of the number of newly received notifications.
- When the app icon badge becomes 0, all the notifications stacked up on the notification center will be removed.
- The time that the app icon badge becomes 0 with the Hive SDK is described as below.
- The first run of the app
- When the app gets back to the foreground via clicking one of its notifications.
- Android
- The app icon badge increases by 1 as a new notification arrives.
- When the app gets back to the foreground, by clicking one of its notifications to run the app or by some other ways, the badge is reset to 0.
- Only the clicked notifications will be removed from the notification center.