Hive provides functions to send Remote Push, to search and change Push Settings. What game developers should do is to create the setting UI for user to opt in or out of Push Services.
Sending Remote Push
Remote Push is sent in two ways; by Hive Console, and by calling API from Game Server to Hive Server. Therefore, there is nothing you need to do on the game client to send or receive Remote Push.
For more details, click the link below.
Searching Push Settings
Hive defines RemotePush
class with the following contents about the user’s Remote Push configuration status.
Name | Type | Description |
---|---|---|
isAgreeNotice | Boolean | It describes the activation status of Announcement Notification which user set
|
isAgreeNight | Boolean | It describes the activation status of Night-time Notification which user set
|
To search information about Remote Push status of the user stored in the Hive server, call getRemotePush()
method of Push class, and check RemotePush
object returned as a result of the search.
Followings are sample codes to search the settings for Remote Push.
API Reference: hive.Push.getRemotePush
1 2 3 4 5 6 7 |
using hive; Push.getRemotePush((ResultAPI result, RemotePush remotePush) => { if (result.isSuccess()) { // call successful } }); |
API Reference: Push::getRemotePush
1 2 3 4 5 6 7 8 9 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; Push::getRemotePush([=](ResultAPI result, RemotePush remotePush) { if (result.isSuccess()) { // call successful } }); |
API Reference: Push.getRemotePush
1 2 3 4 5 6 7 8 9 10 |
import com.hive.Push import com.hive.ResultAPI Push.getRemotePush(object : Push.RemotePushListener { override fun onPushToken(result: ResultAPI, remotePush: Push.RemotePush?) { if (result.isSuccess) { // call successful } } }) |
API Reference: com.hive.Push.getRemotePush
1 2 3 4 5 6 7 8 |
import com.hive.Push; import com.hive.ResultAPI; Push.INSTANCE.getRemotePush((result, remotePush) -> { if (result.isSuccess()) { // call successful } }); |
API Reference: PushInterface .getRemotePush
1 2 3 4 5 6 7 |
import HIVEService PushInterface.getRemotePush() { result, remotePush in if result.isSuccess() { // call successful } } |
API Reference: HIVEPush:getRemotePush
1 2 3 4 5 6 7 |
#import <HIVEService/HIVEService-Swift.h> [HIVEPush getRemotePush: ^(HIVEResultAPI *result, HIVERemotePush *remotePush) { if ([result isSuccess]) { // call successful } }]; |
Changing Push Settings
If a user changes status of Announcement Notification or Night-time Notification, you should send the updated data to Hive Server. To deliver the updated data to Hive Server, set the data to remotePush
parameter (RemotePush
object) to call setRemotePush()
method of Push class, and then check the result with callback function.
Followings are sample codes to change push settings for advertisement.
API Reference: hive.Push.setRemotePush
1 2 3 4 5 6 7 8 9 10 11 |
using hive; RemotePush remotePush = new RemotePush(); remotePush.isAgreeNotice = true; remotePush.isAgreeNight = false; Push.setRemotePush(remotePush, (ResultAPI result, RemotePush remotePush) => { if (result.isSuccess()) { // call successful } }); |
API Reference: Push::setRemotePush
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; HIVERemotePush remotePush; remotePush.isAgreeNotice = true; remotePush.isAgreeNight = false; Push::setRemotePush(remotePush, [=](resultAPI result, HIVERemotePush remotePush) { if (result.isSuccess()) { // call successful } }); |
API Reference: Push.setRemotePush
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import com.hive.Push import com.hive.ResultAPI val remotePush = Push.RemotePush() remotePush.isAgreeNotice = true remotePush.isAgreeNight = false Push.setRemotePush(remotePush, object : Push.RemotePushListener { override fun onPushToken(result: ResultAPI, remotePush: Push.RemotePush?) { if (result.isSuccess) { // call successful } } }) |
API Reference: com.hive.Push.setRemotePush
1 2 3 4 5 6 7 8 9 10 11 12 |
import com.hive.Push; import com.hive.ResultAPI; Push.RemotePush remotePush = new Push.RemotePush(); remotePush.setAgreeNotice(true); remotePush.setAgreeNight(false); Push.INSTANCE.setRemotePush(remotePush, (result, remotePush1) -> { if (result.isSuccess()) { // call successful } }); |
API Reference: PushInterface.setRemotePush
1 2 3 4 5 6 7 8 9 10 11 |
import HIVEService let remotePush = RemotePush() remotePush.isAgreeNotice = true remotePush.isAgreeNight = false PushInterface.setRemotePush(remotePush) { result, remotePush in if result.isSuccess() { // call successful } } |
API Reference: HIVEPush:setRemotePush
1 2 3 4 5 6 7 8 9 10 11 |
#import <HIVEService/HIVEService-Swift.h> HIVERemotePush *remotePush = [[HIVERemotePush alloc] init]; remotePush.isAgreeNotice = YES; remotePush.isAgreeNight = NO; [HIVEPush setRemotePush: remotePush handler: ^(HIVEResultAPI *result, HIVERemotePush *remotePush){ if ([result isSuccess]) { // call successful } }]; |