Getting started
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 Example for Android
-
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.
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 SDK 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.
Note
Configuration night-time notice for games with Hive SDK earlier than v1.12.0 demands Country code Object to check where users play games from.
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
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
}
});
#include "HivePush.h"
// Remote push settings
bool bUseForegroundRemotePush = true;
// Local push settings
bool bUseForegroundLocalPush = false;
FHivePushSetting PushSetting(bUseForegroundRemotePush, bUseForegroundLocalPush);
FHivePush::SetForegroundPush(PushSetting, FHivePushOnPushSettingDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHivePushSetting& PushSetting) {
if (Result.IsSuccess()) {
// call successful
// setting: Result of whether to display notifications set via API
}
}));
API Reference: Push ::setForegroundPush
#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
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
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
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
#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
API Reference: Push ::getForegroundPush
API Reference: Kotlin
API Reference: Push.INSTANCE .getForegroundPush
API Reference: PushInterface .getForegroundPush
API Reference: HIVEPush getForegroundPush
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 SDK 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
API Reference: Push::requestPushPermission
API Reference: Push.requestPushPermission
API Reference: Push.INSTANCE.requestPushPermission
API Reference: PushInterface.requestPushPermission
API Reference: 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.