iOS
Android
Unity
REST Api
BDArenaPush

Availability : ver 3.2 and later

Declared in : BDArenaPush.h

Sample code : -

Overview

The BDArenaPush class is the main interface for accessing the methods for receiving and sending push

notifications.

 

The BDArenaPush object is accessible through pushConnector property

of the unique BDArenaConnector instance. 

 

 

    BDArenaConnector* arenaConnector = [BDArenaConnector getInstance];    

    BDArenaPush* pushConnector = arenaConnector.pushConnector; 

 

 

 

In order to let the SDK report the users feedback about notifications

(how many players are reached by a notification, how many players launched the app

througha received notification), the developer needs to add the following calls

to the AppDelegate's entry point mehtods :

 

 

In application:didFinishLaunchingWithOptions:

 

 

- (BOOL)application:(UIApplication *)application

        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

            ...

            ...

            ...

            [BDArenaConnector initializeWithAppKey:@"<YOUR_APP_KEY>" 

                        runInSandboxEnvironment:<YOUR_ENVIRONMENT>];

            ...

            ...

            [[BDArenaConnector getInstance].pushConnector 

                        feedbackServiceDidFinishLaunchingWithOptions:launchOptions];

 

 } 

 

 

 

In application:didRegisterForRemoteNotificationsWithDeviceToken:

 

 

- (void)application:(UIApplication*)application

            didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{

            ...

            [[BDArenaConnector getInstance

                     registerDeviceForPushNotifications:deviceToken];

 }

 

 

 

In application:didReceiveRemoteNotification:

 

 

- (void)application:(UIApplication*)application

            didReceiveRemoteNotification:(NSData*)deviceToken{

            ...

            [[BDArenaConnector getInstance

                        feedbackServiceDidReceiveRemoteNotification:userInfo];

            ...

 }

 

Methods

Operations 

- updateBadgeCount:

- sendPush:toPlayerWithAuid:

- sendPush:toChannel:

- subscribeToChannel:

- unsubscribeFromChannel:

- getSubscriptions

- handlePush:withPresentingController:withActionButtonHandler:withCancelButtonHandler:

- feedbackServiceDidFinishLaunchingWithOptions:

- feedbackServiceDidReceiveRemoteNotification:

 


 

 

updateBadgeCount:

 

Sets the application's badge value.

 

- (void) updateBadgeCount:(NSInteger)count;

 

Parameters 

count

    Sets the value of the application's badge icon.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

sendPush:toPlayerWithAuid:

 

Sends a push notification to a specific player.

 

- (void) sendPush:(BDArenaPushData*)pushData toPlayerWithAuid:(NSInteger)auid;

 

Parameters 

pushData

    An BDArenaPushData object that brings the notification's parameters.

auid

    The targets player's auid.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

sendPush:toChannel:

 

Sends a push notification to a specific channel.

 

- (void) sendPush:(BDArenaPushData*)pushData toChannel:(NSString*)channelName;

 

Parameters 

pushData

    An BDArenaPushData object that brings the notification's parameters.

channelName

    The target channel name for sending a notification to.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

subscribeToChannel:

 

Sets the local player as a subscriber of a specific channel in order to start receiving

the notifications sent to that channel.

 

- (void) subscribeToChannel:(NSString*)channelName;

 

Parameters 

channelName

    The name of the channel to which the local player will subscribe.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

unsubscribeFromChannel:

 

Unsets the local player as a subscriber of a specific channel in order to stop receiving

the notifications sent to that channel.

 

- (void) unsubscribeFromChannel:(NSString*)channelName;

 

Parameters 

channelName

    The name of the channel to which the local player will unsubscribe.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

getSubscriptions

 

Retrieves the list of the channels subscribed by the local player.

 

- (void) getSubscriptions;

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

handlePush:withPresentingController:

    withActionButtonHandler:withCancelButtonHandler:

 

Shows up an UIAlertController displaying the message received from a push notification.

 

- (void) handlePush:(NSDictionary*)userInfo

        withPresentingController:(UIViewController*)presentingController

        withActionButtonHandler:(BDArenaVoidBlock)actionHandler

        withCancelButtonHandler:(BDArenaVoidBlock)cancelHandler;

 

Parameters

userInfo

    The NSDictionary returned by 'application:didReceiveRemoteNotification:' AppDelegate's native method.

presentingController

    The UIViewController to pass to the UIAlertController in order to display the alert.

actionHandler

    The block in which the developer can implement the app logic in case the user presses 'Ok' button.

cancelHandler

    The block in which the developer can implement the app logic in case the user presses 'Cancel' button.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

feedbackServiceDidFinishLaunchingWithOptions:

 

Sends feedback if the user opens the application through a received push notification.

This method signals that the application was not previously running in background.

 

- (void) feedbackServiceDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions;

 

Parameters

launchOptions

    The NSDictionary returned by 'application:didFinishLaunchingWithOptions:' AppDelegate's native method.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h

 

 

 

feedbackServiceDidReceiveRemoteNotification:

 

Sends feedback if the user opens the application through a received push notification.

This method signals that the application was previously running in background.

 

- (void) feedbackServiceDidReceiveRemoteNotification:(NSDictionary *)userInfo;

 

Parameters

userInfo

    The NSDictionary returned by 'application:didReceiveRemoteNotification:' AppDelegate's native method.

 

Availability

available in SDK ver 3.2 and later

 

Declared in

BDArenaPush.h