Skip to content

Sending remote Push

Hive SDK 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 SDK 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 true: Users opted in Announcement Notification false: Users opted out of Announcement Notification No installation history existed: true If no value from the server : true
isAgreeNight Boolean It describes the activation status of Night-time Notification which user set true: Users opted in Night-time Notification false: Users opted out of Night-time Notification No installation history existed: Korea; false, Countries except Korea; true If no value from the server: false

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

using hive;    
    Push.getRemotePush((ResultAPI result, RemotePush remotePush) => {    
        if (result.isSuccess()) {    
        // call successful    
        }    
});
#include "HivePush.h"

FHivePush::GetRemotePush(FHivePushOnRemotePushDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveRemotePush& RemotePush) {
        if (Result.IsSuccess()) {
                // API call successfull
        }
}));

API Reference: Push::getRemotePush

#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

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

import com.hive.Push;    
    import com.hive.ResultAPI;    
    Push.INSTANCE.getRemotePush((result, remotePush) -> {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: PushInterface .getRemotePush

import HIVEService    
    PushInterface.getRemotePush() { result, remotePush in    
        if result.isSuccess() {    
        // call successful    
        }    
}

API Reference: HIVEPush:getRemotePush

#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

using hive;    
    RemotePush remotePush = new RemotePush();    
    remotePush.isAgreeNotice = true;    
    remotePush.isAgreeNight = false;    

    Push.setRemotePush(remotePush, (ResultAPI result, RemotePush remotePush) => {    
        if (result.isSuccess()) {    
        // call successful    
        }    
});
#include "HivePush.h"

bool bNotice = true;
bool bNight = false;
FHiveRemotePush RemotePush(bNotice, bNight);

FHivePush::SetRemotePush(RemotePush, FHivePushOnRemotePushDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveRemotePush& RemotePush) {
        if (Result.IsSuccess()) {
                // API call successfull
        }
}));

API Reference: Push::setRemotePush

#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

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

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

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

#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    
        }    
}];