App42 provides Push Notifications through the App42 Cloud APIs as well as through App42 Marketing Automation (Campaign & Segmentation based)
Operations supported through App42 Cloud APIs include:
All the features are supported not only through the APIs but also through our intuitive AppHQ Management console which the marketers can use. Refer App42 Marketing Automation tutorial for sending Campaign and Segment based Push Notifications.
import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.push.DeviceType; import com.shephertz.app42.paas.sdk.android.push.PushNotification; import com.shephertz.app42.paas.sdk.android.push.PushNotificationService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.push;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"#import<Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h>import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.push.DeviceType; import com.shephertz.app42.paas.sdk.java.push.PushNotification; import com.shephertz.app42.paas.sdk.java.push.PushNotificationService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.push;<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>local App42API = require("App42-Lua-API.App42API") require("App42-Lua-API.DeviceType") require("App42-Lua-API.Operator")#include "App42API.h"using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.push;include_once '../PushNotificationService.php'; include_once '../DeviceType.php'; include_once '../App42Log.php'; include_once '../App42Exception.php'; include_once '../App42NotFoundException.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../StorageService.php'; include_once '../QueryBuilder.php'; include_once '../Query.php';#include "App42API.h"require 'App42_Ruby_API'import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.push.Channel; import com.shephertz.app42.paas.sdk.as3.push.PushNotification; import com.shephertz.app42.paas.sdk.as3.push.PushNotificationService;Coming SoonNot Available
In order to use the various functions available in a specific API, a developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after you create app from AppHQ dashboard.
Required Parameters
apiKey - The application key given when the app was created.
secretKey - The secret key corresponding to the application key given when the app was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");App42API:initialize("API_KEY","SECRET_KEY")PushNotificationService::Initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");PushNotificationService::Initialize("API_KEY","SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonNot Available
After initialization, the developer wil have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of PushNotificationService, buildPushNotificationService() method needs to be called.
PushNotificationService pushNotificationService = App42API.buildPushNotificationService();PushNotificationService pushNotificationService = App42API.BuildPushnotificationService();PushNotificationService *pushNotificationService = [App42API buildPushService];let pushNotificationService = App42API.buildPushService() as? PushNotificationServicePushNotificationService pushNotificationService = App42API.buildPushNotificationService();PushNotificationService pushNotificationService = App42API.BuildPushnotificationService();var pushNotificationService = new App42Push();local pushNotificationService = App42API:buildPushNotificationService()PushNotificationService* pushNotificationService = PushNotificationService::getInstance();PushNotificationService pushNotificationService = App42API.BuildPushnotificationService();$pushNotificationService = App42API::buildPushNotificationService();PushNotificationService* pushNotificationService = PushNotificationService::getInstance();push_notification_service = api.build_push_notification_service()var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService();Coming SoonNot Available
Upload apiKey/certificate to the server that will be used while sending notifications to the devices.
Required Parameters
apiKey - the apiKey which you have received while registering for GCM.
password - Password which has been given while export .p12 file.
filePath - Path of certificates.p12 file.
environment - It can be development or production.
String apikey = "api Key"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.uploadApiKey(apikey, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println(pushNotification); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *filePath = [[NSBundle mainBundle]pathForResource:@"Certificate" ofType:@".p12"]; NSString *password = @"******"; NSString *environment = @"development"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService uploadFile:password filePath:filePath environment:environment completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"fileName is %@" , pushNotification.fileName); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Coming SoonNot AvailableNot AvailableNot AvailableNot AvailableNot AvailableNot AvailableNot AvailableNot AvailableNot AvailableNot AvailableComing SoonNot Available
Store your device token on server with a particular username.
Required Parameters
userName - Username with which you want your device to be registered.
deviceToken - Device token that has to be registered.
deviceType - Type of device like Android, iOS , etc.
String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.storeDeviceToken(userName, deviceToken, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("DeviceToken is " + pushNotification.getDeviceToken()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.StoreDeviceToken(userName,deviceToken, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("Type is " + pushNotification.GetType()); Console.WriteLine("DeviceToken is " + pushNotification.GetDeviceToken()); } }NSString *userName = @"Nick"; NSString *deviceToken = @"Device Token"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService registerDeviceToken:deviceToken withUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"type is %@" , pushNotification.type); NSLog(@"type is %@" , pushNotification.deviceToken); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let deviceToken = "123" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.registerDeviceToken(deviceToken, withUser:userName, completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.userName) NSLog("%@", pushNotification.deviceToken) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.storeDeviceToken(userName,deviceToken,DeviceType.ANDROID); System.out.println("userName is " + pushNotification.getUserName()); System.out.println("type is " + pushNotification.getType()); System.out.println("DeviceToken is " + pushNotification.getDeviceToken()); String jsonResponse = pushNotification.toString();String userName = "Nick"; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.StoreDeviceToken(userName,deviceToken,DeviceType.ANDROID, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("UserName is " + pushNotification.GetUserName()); App42Log.Console("Type is " + pushNotification.GetType()); App42Log.Console("DeviceToken is " + pushNotification.GetDeviceToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", deviceToken = "Device Token", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.storeDeviceToken(userName, deviceToken,DeviceType.ANDROID,{ success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) console.log("Type is : " + result.type); console.log("DeviceToken is : " + result.deviceToken); }, error: function(error) { } });local userName = "Nick"; local deviceToken = "Device Token"; local deviceType= DeviceType.ANDROID; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:storeDeviceToken(userName,deviceToken,deviceType,App42CallBack); function App42CallBack:onSuccess(object) print("Username is "..object:getUserName()); print("Type is "..object:getType()); print("DeviceToken is "..object:getDeviceToken()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* deviceToken = "Device Token"; const char* userName = "Nick"; DeviceType deviceType = IOS; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->RegisterDeviceToken(deviceToken, userName, deviceType, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type = %s",it->type.c_str()); printf("\n Type = %s",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.StoreDeviceToken(userName,deviceToken,DeviceType.ANDROID); Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("Type is " + pushNotification.GetType()); Console.WriteLine("DeviceToken is " + pushNotification.GetDeviceToken()); String jsonResponse = pushNotification.ToString();$userName ="Nick"; $deviceToken = "Device Token"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->storeDeviceToken($userName,$deviceToken , DeviceType::WP7); print_r("UserName is " . $pushNotification->getUserName()); print_r("Type is " . $pushNotification->getType()); print_r("DeviceToken is " . $pushNotification->getDeviceToken()); $jsonResponse = $pushNotification->toString();const char* deviceToken = "Device Token"; const char* userName = "Nick"; DeviceType deviceType = IOS; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->RegisterDeviceToken(deviceToken, userName, deviceType, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type = %s",it->type.c_str()); printf("\n Type = %s",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }user_name = "Nick"; device_token = "Device Token"; dtype = App42::AppTab::DeviceType.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.store_device_token(user_name, device_token, dtype.enum("WP7")); puts "UserName is #{push_notification.user_name}"; puts "Type is #{push_notification.type}"; puts "DeviceToken is #{push_notification.device_token}"; json_response = push_notification.to_s();var userName:String = "Nick"; var deviceToken:String = "Device Token"; var deviceType:String= DeviceType.ANDROID; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.storeDeviceToken(userName , deviceToken, deviceType , new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("UserName is " + pushNotification.getUserName()); trace("Type is " + pushNotification.getType()); trace("DeviceToken is " + pushNotification.getDeviceToken()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Create channel for the app on which user can subscribe and get the notifications for that channel.
Required Parameters
channel - Channel name which you want to create.
description - Description for that channel.
String channel = "News Channel"; String description = "Channel all about the news"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.createChannelForApp(channel, description, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); System.out.println("Description is " + channelObj.getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channel = "News Channel"; String description = "Channel all about the news"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.CreateChannelForApp(channel,description, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception : "+ exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("channelName is " + pushNotification.GetChannelList()[0].GetName()); Console.WriteLine("Description is " + pushNotification.GetChannelList()[0].GetDescription()); } }NSString *channel = @"News Channel"; NSString *description = @"Channel all about the news"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService createChannelForApp:channel description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSMutableArray *channelArray = pushNotification.channelList; for(Channel *channel in channelArray) { NSLog(@"Channel Name is = %@ " , channel.channelName); } NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];NSLog("CreateChannelForApp") let channel = "News Channel" let description = "123456" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.createChannelForApp(channel, description: description,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification let channelList = pushNotification.channelList for channel in channelList { NSLog("%@", channel.channelName) NSLog("%@", channel.description) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String channel = "News Channel"; String description = "Channel all about the news"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.createChannelForApp(channel,description); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); System.out.println("Description is " + channelObj.getDescription()); } String jsonResponse = pushNotification.toString();String channel = "News Channel"; String description = "Channel all about the news"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.CreateChannelForApp(channel,description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("channelName is " + pushNotification.GetChannelList()[0].GetName()); App42Log.Console("Description is " + pushNotification.GetChannelList()[0].GetDescription()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channel = "News Channel", description = "Channel all about the news", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.createChannelForApp(channel, description,{ success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push.channels.channel; console.log("ChannelName is : " + result.channelName) console.log("Description is: " + result.description); }, error: function(error) { } });local channel = "News Channel"; local description = "Channel all about the news"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:createChannelForApp(channel,description,App42CallBack); function App42CallBack:onSuccess(object) print("channelName is :"..object:getChannelList():getName()) print("Description is: "..object:getChannelList():getDescription()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* channel = "News Channel"; const char* description = "Channel all about the news"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->CreateChannel(channel,description, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); printf("\n Description=%s\n",channel->description.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String channel = "News Channel"; String description = "Channel all about the news"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.CreateChannelForApp(channel,description); Console.WriteLine("channelName is " + pushNotification.GetChannelList()[0].GetName()); Console.WriteLine("Description is " + pushNotification.GetChannelList()[0].GetDescription()); String jsonResponse = pushNotification.ToString();$channel = "News Channel"; $description = "Channel all about the news"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->createChannelForApp($channel,$description); $channel = $pushNotification->getChannelList(); foreach($channel as $channelList) { print_r("channelName is " . $channelList->getName()); print_r("Description is " . $channelList->getDescription()); } $jsonResponse = $pushNotification->toString();const char* channel = "News Channel"; const char* description = "Channel all about the news"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->CreateChannel(channel,description, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); printf("\n Description=%s\n",channel->description.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }channel = "News Channel"; description = "channel all about the news"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.create_channel_for_app(channel, description); channel_list = Array.new(); channel_list = push_notification.channel_list(); for channel_obj in channel_list puts "ChannelName is #{channel_obj.channel_name}"; puts "Description is #{channel_obj.channel_description}"; end json_response = push_notification.to_s();var channel:String = "News Channel"; var description:String = "Channel all about the news"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.createChannelForApp(channel,description,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); trace("Description is : "+ Channel(pushNotification.getChannelList()[j]).getDescription()); } } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
User will be subscribed to the selected existing Channel.
Required Parameters
channel - Name of the channel which the user wants to subscribe.
userName - Name of the user who wants to subscribe to that channel.
String channel = "News Channel"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.subscribeToChannel(channel, userName, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("UserName is " + pushNotification.getUserName()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channel = "News Channel"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SubscribeToChannel(channel,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("userName is " + pushNotification.GetUserName()); Console.WriteLine("channelName is " + pushNotification.GetChannelList()[0].GetName()); } }NSString *channel = @"News Channel"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService subscribeToChannel:channel userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSMutableArray *channelArray = pushNotification.channelList; for(Channel *channel in channelArray) { NSLog(@"Channel Name is = %@ " , channel.channelName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];NSLog("SubscribeToChannel") let channel = "News Channel" let userName = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.subscribeToChannel(channel, userName: userName,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification let channelList = pushNotification.channelList for channel in channelList { NSLog("%@", channel.channelName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String channel = "News Channel"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.subscribeToChannel(channel,userName); System.out.println("UserName is " + pushNotification.getUserName()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); }String channel = "News Channel"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SubscribeToChannel(channel,userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("userName is " + pushNotification.GetUserName()); App42Log.Console("channelName is " + pushNotification.GetChannelList()[0].GetName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channel = "News Channel", userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.subscribeToChannel(channel, userName,{ success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push.channels.channel; console.log("UserName is : " + pushNotification.app42.response.push.userName) console.log("ChannelName is : " + result.channelName) }, error: function(error) { } });local channel = "News Channel"; local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:subscribeToChannel(channel,userName,App42CallBack); function App42CallBack:onSuccess(object) print("UserName is "..object:getUserName()); print("ChannelName :"..object:getChannelList():getName()) end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* userName = "Nick"; const char* channelName = "News Channel"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SubscribeToChannel(channelName,userName, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String channel = "News Channel"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.SubscribeToChannel(channel,userName); Console.WriteLine("userName is " + pushNotification.GetUserName()); Console.WriteLine("channelName is " + pushNotification.GetChannelList()[0].GetName());$channelName = "News Channel"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->subscribeToChannel($channelName,$userName); print_r("UserName is " . $pushNotification->getUserName()); $channel = $pushNotification->getChannelList(); foreach($channel as $channelList) { print_r("channelName is " . $channelList->getName()); }const char* userName = "Nick"; const char* channelName = "News Channel"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SubscribeToChannel(channelName,userName, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }channel_name = "News Channel"; user_name = "Nick"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.subscribe_to_channel(channel_name, user_name); puts "UserName is #{push_notification.user_name}"; channel_list = Array.new(); channel_list = push_notification.channel_list(); for channel_obj in channel_list puts "channelName is #{channel_obj.name}"; endvar channel:String = "News Channel"; var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.subscribeToChannel( channel , userName, new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); } } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Unsubscribe from a particular channel.
Required Parameters
channel - Name of the channel which the user wants to unsubscribe from.
userName - Name of the user who wants to unsubscribe from that channel.
String channel = "News Channel"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.unsubscribeFromChannel(channel, userName, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("UserName is " + pushNotification.getUserName()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channel = "News Channel"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UnsubscribeFromChannel(channel,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("userName is " + pushNotification.GetUserName()); Console.WriteLine("channelName is " + pushNotification.GetChannelList()[0].GetName()); } }NSString *channel = @"News Channel"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService unsubscribeFromChannel:channel userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSMutableArray *channelArray = pushNotification.channelList; for(Channel *channel in channelArray) { NSLog(@"Channel Name is = %@ " , channel.channelName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let channel = "News Channel" let userName = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.unsubscribeFromChannel(channel, userName: userName,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification let channelList = pushNotification.channelList for channel in channelList { NSLog("%@", channel.channelName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String channel = "News Channel"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.unsubscribeFromChannel(channel,userName); System.out.println("UserName is " + pushNotification.getUserName()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); }String channel = "News Channel"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UnsubscribeFromChannel(channel,userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("userName is " + pushNotification.GetUserName()); App42Log.Console("channelName is " + pushNotification.GetChannelList()[0].GetName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channel = "News Channel", userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.unsubscribeFromChannel(channel, userName,{ success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push.channels.channel; console.log("UserName is : " + pushNotification.app42.response.push.userName) console.log("ChannelName is : " + result.channelName) }, error: function(error) { } });local channel = "News Channel"; local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:unsubscribeFromChannel(channel,userName,App42CallBack); function App42CallBack:onSuccess(object) print("UserName is "..object:getUserName()); print("GetName :"..object:getChannelList():getName()) end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* userName = "Nick"; const char* channelName = "News Channel"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->UnsubscribeFromChannel(channelName,userName, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String channel = "News Channel"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.UnsubscribeFromChannel(channel,userName); Console.WriteLine("userName is " + pushNotification.GetUserName()); Console.WriteLine("channelName is " + pushNotification.GetChannelList()[0].GetName());$channelName = "News Channel"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->unsubscribeFromChannel($channelName,$userName); print_r("UserName is " . $pushNotification->getUserName()); $channel = $pushNotification->getChannelList(); foreach($channel as $channelList) { print_r("channelName is " . $channelList->getName()); }const char* userName = "Nick"; const char* channelName = "News Channel"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->UnsubscribeFromChannel(channelName,userName, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }channel_name = "News Channel"; user_name = "Nick"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.unsubscribe_to_channel(channel_name, user_name); puts "UserName is #{push_notification.user_name}"; channel_list = Array.new(); channel_list = push_notification.channel_list(); for channel_obj in channel_list puts "channelName is #{channel_obj.name}"; end json_response = push_notification.to_s();var channel:String = "News Channel"; var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.unsubscribeFromChannel( channel , userName, new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); } } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Send push messages to a particular channel.
Required Parameters
channel - Name of the channel to which you want to send messages.
message - Message which you want to send.
String channel = "News Channel"; String message = "Message which you have to send"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToChannel(channel,message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("Message is " + pushNotification.getMessage()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channel = "News Channel"; String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToChannel(channel,message,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }NSString *channelName = @"News Channel"; NSString *message = @"Message"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService sendPushMessageToChannel:channelName withMessage:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSMutableArray *channelArray = pushNotification.channelList; for(Channel *channel in channelArray) { NSLog(@"Channel Name is = %@ " , channel.channelName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let channel = "News Channel" let message = "Hi" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.sendPushMessageToChannel(channel, withMessage:message,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.message) let channelList = pushNotification.channelList for channel in channelList { NSLog("%@", channel.channelName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String channel = "News Channel"; String message = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.sendPushMessageToChannel(channel,message); System.out.println("Message is " + pushNotification.getMessage()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } String jsonResponse = pushNotification.toString();String channel = "News Channel"; String message = "Message which you have to send"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToChannel(channel,message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Message is " + pushNotification.GetMessage()); App42Log.Console("channel is : " + pushNotification.GetChannelList()[0].GetName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channel = "News Channel", message = "Message which you have to send", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.sendPushMessageToChannel(channel, message,{ success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push.channels.channel; console.log("Message is : " + pushNotification.app42.response.push.message) console.log("ChannelName is : " + result.channelName) }, error: function(error) { } });local channel = "News Channel"; local message = "Message which you have to send"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:sendPushMessageToChannel(channel,message,App42CallBack); function App42CallBack:onSuccess(object) print("Message is :"..object:getMessage()); print("channel is :"..object:getChannelList():getName()) end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* channelName = "News Channel"; const char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToChannel(channelName, message,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n Message=%s\n",it->message.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String channel = "News Channel"; String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.SendPushMessageToChannel(channel,message); Console.WriteLine("channelName is " + pushNotification.GetChannelList()[0].GetName()); Console.WriteLine("message is " + pushNotification.GetMessage()); String jsonResponse = pushNotification.ToString();$channelName = "News Channel"; $message = "Message which you have to send"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToChannel($channelName,$message); print_r("Message is " . $pushNotification->getMessage()); $channel = $pushNotification->getChannelList(); foreach ($channel as $channelList) { print_r("channelName is " . $channelList->getName()); } $jsonResponse = $pushNotification->toString();const char* channelName = "News Channel"; const char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToChannel(channelName, message, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n Message=%s\n",it->message.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }channel = "News Channel"; message = "Message which you have to send"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.send_push_message_to_channel(channel, message); puts "Message is #{push_notification.message}"; channel_list = Array.new(); channel_list = push_notification.channel_list(); for channel_obj in channel_list puts "channelName is #{channel_obj.name}"; end json_response = push_notification.to_s();var channel:String = "News Channel"; var message:String = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToChannel(channalName,message ,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("Message is : " + pushNotification.getMessage()); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); } } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming Soonlet message = "Hi All" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.sendPushMessageToAll(message,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.message) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })
Send push message to all your users.
Required Parameters
message - Message which you want to send.
String message = "Message which you have to send"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToAll( message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is " + pushNotification.getExpiry()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToAll(message,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }NSString *message = @"Message which you have to send"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService sendPushMessageToAll:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableString message = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.sendPushMessageToAll(message); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is " + pushNotification.getExpiry()); String jsonResponse = pushNotification.toString();String message = "Message which you have to send"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToAll(message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Message is " + pushNotification.GetMessage()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var message = "Message which you have to send", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.sendPushMessageToAll(message, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("Message is : " + result.message) console.log("Expiry is : " + result.expiry) }, error: function(error) { } });local message = "Message which you have to send"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:sendPushMessageToAll(message,App42CallBack); function App42CallBack:onSuccess(object) print("Message is :"..object:getMessage()); print("Expiry is : "..object:getExpiry()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToAll(message,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.SendPushMessageToAll(message); Console.WriteLine("message is " + pushNotification.GetMessage()); String jsonResponse = pushNotification.ToString();$message = "Message which you have to send"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToAll($message); print_r("message is " . $pushNotification->getMessage()); print_r("Expiry is " . $pushNotification->getExpiry()); $jsonResponse = $pushNotification->toString();const char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToAll(message,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }message = "Message which you have to send"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.send_push_message_to_all(message); puts "Message is #{push_notification.message}"; json_response = push_notification.to_s();var message:String = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToAll(message,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("Expiry is " + pushNotification.getExpiry()); trace("Message is " + pushNotification.getMessage()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Send push message to all by device type which is subscribed. For example Android/iOS/WP
Required Parameters
message - Message which you want to send.
deviceType - Type of device to which you want to send a message.
Not AvailableNot AvailableNot AvailableComing SoonString message = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.sendPushMessageToAllByType(message,DeviceType.ANDROID); System.out.println("message is " + pushNotification.getMessage()); String jsonResponse = pushNotification.toString();String message = "Message which you have to send"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToAllByType(message, DeviceType.ANDROID, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Message is " + pushNotification.GetMessage()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var message = "Message which you have to send", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.sendPushMessageToAllByType(message, DeviceType.ANDROID,{ success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log(("Type is : " + result.type); console.log("Message is : " + result.message) console.log("Expiry is : " + result.expiry) }, error: function(error) { } });local message = "Message which you have to send"; local deviceType= DeviceType.ANDROID; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:sendPushMessageToAllByType(message,deviceType,App42CallBack); function App42CallBack:onSuccess(object) print("Message is :"..object:getMessage()); print("Expiry is :"..object:getExpiry()); print("Type is :"..object:getType()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* message = "Message which you have to send"; DeviceType deviceType = IOS; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToAllByType(message,deviceType,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); printf("\n Type = %s",it->type.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.SendPushMessageToAllByType(message,DeviceType.ANDROID); Console.WriteLine("message is " + pushNotification.GetMessage()); String jsonResponse = pushNotification.ToString();$message = "Message which you have to send"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToAllByType($message,DeviceType::ANDROID); print_r("Message is :".$pushNotification->getMessage()); print_r("Expiry is :".$pushNotification->getExpiry()); print_r("Type is :".$pushNotification->getType()); $jsonResponse = $pushNotification->toString();const char* message = "Message which you have to send"; DeviceType deviceType = IOS; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToAllByType(message,deviceType,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); printf("\n Type = %s",it->type.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }message = "Message which you have to send"; dtype = App42::AppTab::DeviceType.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.send_push_message_to_all_by_type(message, dtype.enum("ANDROID")); puts "Message is #{push_notification.message}"; puts "Type is #{push_notification.type}"; json_response = push_notification.to_s();var message:String = "Message which you have to send"; var deviceType:String= DeviceType.ANDROID; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToAllByType(message, deviceType,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("Device Type is : "+pushNotification.getType()); trace("Expiry is :" + pushNotification.getExpiry()); trace("Message is : " + pushNotification.getMessage()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Send a push message to the channel containing JSON. On receiving this message on device, it has to be parsed and accessed accordingly.
Required Parameters
channel - Name of the channel to which you want to send message.
message - Message which you want to send.
String channelName = "News Channel"; HashMap< String,String> message = new HashMap< String,String>(); message.put("alert", "Hello! This is my first notification."); message.put("badge", "1"); //Applicable for iOS only message.put("sound", "default"); //Applicable for iOS only message.put("sendingFrom", "Android"); //This is Custom application key App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToChannel(channelName, message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("Message is " + pushNotification.getMessage()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; NSString *channelName = @"News Channel"; [dictionary setObject:@"Hello! This is my first notification." forKey:@"alert"]; [dictionary setObject:@"default" forKey:@"sound"]; // Applicable only for iOS push notification [dictionary setObject:@"2" forKey:@"badge"]; // Applicable only for iOS push notification [dictionary setObject:@"iOS" forKey:@"sendingFrom"]; // This is custom application key [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService sendPushMessageToChannel:channelName withMessageDictionary:dictionary completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Coming SoonNot AvailableNot AvailableNot AvailableNot Availableconst char* channelName = "News Channel"; map<string, string> messageMap; messageMap["alert"] = "Hello! This is my first notification."; messageMap["sound"] = "default"; messageMap["badge"] = "1"; App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToChannel(channelName, messageMap,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); printf("\n Type = %s",it->type.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); printf("\n Description=%s\n",channel->description.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Not AvailableNot Availableconst char* channelName = "News Channel"; map<string, string> messageMap; messageMap["alert"] = "Hello! This is my first notification."; messageMap["sound"] = "default"; messageMap["badge"] = "1"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToChannel(channelName, messageMap, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); printf("\n Type = %s",it->type.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); printf("\n Description=%s\n",channel->description.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Not AvailableNot AvailableComing SoonNot Available
Send push message to a particular user.
Required Parameters
userName - Name of the user to whom you want to send the message.
message - Message which you want to send.
String userName = "Nick"; String message = "Message which you have to send"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToUser(userName, message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is"+pushNotification.getExpiry()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToUser(userName,message,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }NSString *userName = @"Nick"; NSString *message = @"Message which you have to send"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService sendPushMessageToUser:userName message:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let message = "Hi All" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.sendPushMessageToUser(userName,message:message,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.message) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String message = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.sendPushMessageToUser(userName,message); System.out.println("userName is " + pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is"+pushNotification.getExpiry()); String jsonResponse = pushNotification.toString();String userName = "Nick"; String message = "Message which you have to send"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToUser(userName,message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Message is " + pushNotification.GetMessage()); App42Log.Console("userName is : " + pushNotification.GetMessage()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", message = "Message which you have to send", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.sendPushMessageToUser(userName, message, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName); console.log("Message is : " + result.message) console.log("Expiry is : " + result.expiry) }, error: function(error) { } });local userName = "Nick"; local message = "Message which you have to send"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:sendPushMessageToUser(userName,message,App42CallBack); function App42CallBack:onSuccess(object) print("Message is "..object:getMessage()); print("Message is "..object:getExpiry()); print("UserName is "..object:getUserName()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* userName = "Nick"; const char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToUser(userName,message,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.SendPushMessageToUser(userName,message); Console.WriteLine("userName is " + pushNotification.GetUserName()); Console.WriteLine("message is " + pushNotification.GetMessage()); String jsonResponse = pushNotification.ToString();$userName = "Nick"; $message = "Message which you have to send"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToUser($userName,$message); print_r("Message is :".$pushNotification->getMessage()); print_r("Expiry is :".$pushNotification->getExpiry()); print_r("UserName is :".$pushNotification->getUserName()); $jsonResponse = $pushNotification->toString();const char* userName = "Nick"; const char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToUser(userName,message,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }user_name = "Nick"; message = "Message which you have to send"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") push_notification_service = api.build_push_notification_service() push_notification = push_notification_service.send_push_message_to_user(user_name, message); puts "User Name is #{push_notification.user_name}"; puts "Message is #{push_notification.message}"; json_response = push_notification.to_s();var userName:String = "Nick"; var message:String = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToUser(userName,message,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); trace("Expiry is " + pushNotification.getExpiry()); trace("Message is " + pushNotification.getMessage()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Send push message containing JSON or in key value format to the user. On receiving this message on device, it has to be parsed and accessed accordingly.
Required Parameters
userName - Name of the user to which message has to be sent.
message - Message which you want to send in JSON or key value format.
String userName = "Nick"; HashMap< String,String> message = new HashMap< String,String>(); message.put("alert", "Hello! This is my first notification."); message.put("badge", "1"); //Applicable for iOS only message.put("sound", "default"); //Applicable for iOS only message.put("sendingFrom", "Android"); //This is Custom application key App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToUser( userName, message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is"+pushNotification.getExpiry()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *userName = @"Nick"; NSDictionary *messageDictionary = [[NSDictionary alloc]init]; [messageDictionary setObject:@"Hello! This is my first notification." forKey:@"alert"]; [messageDictionary setObject:@"1" forKey:@"badge"]; //Applicable for iOS only [messageDictionary setObject:@"default" forKey:@"sound"]; //Applicable for iOS only [messageDictionary setObject:@"iOS" forKey:@"sendingFrom"]; //This is Custom application key [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService sendPushMessageToUser:userName withMessageDictionary:messageDictionary completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Coming SoonNot AvailableNot AvailableNot AvailableComing Soonconst char* userName = "Nick"; map<string, string> messageMap; messageMap["alert"] = "Hello! This is my first notification."; messageMap["sound"] = "default"; messageMap["badge"] = "1"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToUser(userName, messageMap,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Not Available$userName = "Nick"; $message = "{'alert':'Hello! This is my first notification.','badge':1,'sound':'default','sendingFrom':'serverSide'}"; //Here sound and badge are applicable only for iOS push notification and sendingFrom key is custom application key used. App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToUser($userName,$message);const char* userName = "Nick"; map<string, string> messageMap; messageMap["alert"] = "Hello! This is my first notification."; messageMap["sound"] = "default"; messageMap["badge"] = "1"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToUser(userName, messageMap,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Not AvailableNot AvailableComing SoonNot Available
Subscribe your device to a particular channel with device token and type.
Required Parameters
userName - User that wants to subscribe.
channelName - Name of the channel to which user wants to subscribe.
deviceToken - Device token to which you want to subscribe.
deviceType - Device Type to which you want to subscribe.
String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.subscribeToChannel(userName, channel, deviceToken, DeviceType.ANDROID, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("UserName is " + pushNotification.getUserName()); System.out.println("Device Token "+pushNotification.getDeviceToken()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channel = "News Channel"; String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SubscribeToChannel(userName, channel, deviceToken,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }NSString *userName = @"Nick"; NSString *deviceToken = @"Device_Token"; NSString *channelName = @"New Channel"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService subscribeToChannel:channelName userName:userName deviceToken:deviceToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSMutableArray *channelArray = pushNotification.channelList; for(Channel *channel in channelArray) { NSLog(@"Channel Name is = %@ " , channel.channelName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let channel = "News Channel" let userName = "Nick" let deviceToken = "1234" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.subscribeToChannel(channel, userName: userName,deviceToken:deviceToken,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification let channelList = pushNotification.channelList for channel in channelList { NSLog("%@", channel.channelName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token" App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.subscribeToChannel(userName, channel, deviceToken, DeviceType.iOS); System.out.println("UserName is " + pushNotification.getUserName()); System.out.println("Device Token "+pushNotification.getDeviceToken()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } String jsonResponse = pushNotification.toString();String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SubscribeToChannel(userName, channel, deviceToken, DeviceType.iOS, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("userName is : " + pushNotification.GetMessage()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channel = "News Channel", userName = "Nick", deviceToken = "Device Token", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.registerAndSubscribe(channel, userName, deviceToken, DeviceType.ANDROID, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) console.log("Type is : " + result.type); console.log("DeviceToken is : " + result.deviceToken); console.log("Channel Name is :" + result.channels.channel.channelName) }, error: function(error) { } });local channel = "News Channel"; local userName = "Nick"; local deviceToken = "Device Token"; local deviceType= DeviceType.ANDROID; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:registerAndSubscribe(userName,channel,deviceToken,deviceType,App42CallBack); function App42CallBack:onSuccess(object) print("userName is :"..object:getUserName()); print("userName is :"..object:getType()); print("userName is :"..object:getDeviceToken()); print("Channel Name is :"..object:getChannelList():getName()) end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* channel = "News Channel" ; const char* userName = "Nick" ; const char* deviceToken = "Device Token"; DeviceType deviceType = IOS; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SubscribeToChannel(channelName,userName,deviceToken, deviceType, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type = %s",it->type.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.SubscribeToChannel(userName, channel, deviceToken, DeviceType.iOS); System.out.println(pushNotification.GetUserName()); String jsonResponse = pushNotification.ToString();$channel = "News Channel" ; $userName = "Nick" ; $deviceToken = "Device Token"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->registerAndSubscribe($userName, $channel, $deviceToken, DeviceType::ANDROID); print_r("UserName Is :" . $pushNotification->getUserName()); print_r("Device token Is :" . $pushNotification->getDeviceToken()); print_r("Type Is :" . $pushNotification->getType()); $channel = $pushNotification->getChannelList(); foreach ($channel as $channelList) { print_r("Channel Is :" . $channelList->getName()); }const char* channel = "News Channel" ; const char* userName = "Nick" ; const char* deviceToken = "Device Token"; DeviceType deviceType = IOS; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SubscribeToChannel(channelName,userName,deviceToken, deviceType, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type = %s",it->type.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar channel:String = "News Channel" ; var userName:String = "Nick" ; var deviceToken:String = "Device Token"; var deviceType:String= DeviceType.ANDROID; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.registerAndSubscribe(userName,channel, deviceToken,deviceType,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); trace("DeviceToken :"+pushNotification.getDeviceToken()); trace("Device Type : "+pushNotification.getType()); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); } } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Unsubscribe your device from a particular channel with device token.
Required Parameters
userName - Name of the user who wants to unsubscribe from channel.
channelName - Name of channel from which user wants to unsubscribe.
deviceToken - Device token which with which user wants to unsubscribe.
String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.unsubscribeDeviceToChannel(userName, channel, deviceToken, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("UserName is " + pushNotification.getUserName()); System.out.println("Device Token "+pushNotification.getDeviceToken()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channel = "News Channel"; String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UnsubscribeDeviceToChannel(userName, channel, deviceToken,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }NSString *userName = @"Nick"; NSString *deviceToken = @"Device_Token"; NSString *channelName = @"New Channel"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService unsubscribeDeviceToChannel:channelName userName:userName deviceToken:deviceToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSMutableArray *channelArray = pushNotification.channelList; for(Channel *channel in channelArray) { NSLog(@"Channel Name is = %@ " , channel.channelName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let channel = "News Channel" let userName = "Nick" let deviceToken = "1234" pushNotificationService?.unsubscribeDeviceToChannel(channel, userName: userName,deviceToken:deviceToken,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification let channelList = pushNotification.channelList for channel in channelList { NSLog("%@", channel.channelName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.unsubscribeDeviceToChannel(userName, channel, deviceToken); System.out.println("UserName is " + pushNotification.getUserName()); System.out.println("Device Token "+pushNotification.getDeviceToken()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } String jsonResponse = pushNotification.toString();String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UnsubscribeDeviceToChannel(userName, channel, deviceToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Message is " + pushNotification.GetMessage()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", channel = "News Channel" deviceToken = "Device Token", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.unsubscribeDeviceToChannel(userName, channel, deviceToken, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) console.log("DeviceToken is : " + result.deviceToken); console.log("Channel Name is : " + result.channels.channel.channelName) }, error: function(error) { } });local userName = "Nick"; local channel = "News Channel"; local deviceToken = "Device Token"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:unsubscribeDeviceToChannel(userName,channel,deviceToken,App42CallBack); function App42CallBack:onSuccess(object) print("getStrResponse is : "..object:getStrResponse()); print("userName is :"..object:getUserName()); print("userName is :"..object:getDeviceToken()); print("Channel Name is :"..object:getChannelList():getName()) end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* channel = "News Channel" ; const char* userName = "Nick" ; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->UnsubscribeDeviceToChannel(channelName,userName,deviceToken,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String channel = "News Channel" ; String userName = "Nick" ; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotificationObj = pushNotificationService.UnsubscribeDeviceToChannel(userName, channel, deviceToken); Console.WriteLine(pushNotification.getUserName()); String jsonResponse = pushNotification.ToString();$channel = "News Channel" ; $userName = "Nick" ; $deviceToken = "Device Token"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification= $pushNotificationService->unsubscribeDeviceToChannel($userName, $channel, $deviceToken); print_r("UserName Is :" . $pushNotification->getUserName()); print_r("Device token Is :" . $pushNotification->getDeviceToken()); $channel = $pushNotification->getChannelList(); foreach ($channel as $channelList) { print_r("Channel Is :" . $channelList->getName()); }const char* channel = "News Channel" ; const char* userName = "Nick" ; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->UnsubscribeDeviceToChannel(channelName,userName,deviceToken,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); for(std::vector<App42Channel>::iterator channel = it->channelArray.begin(); channel != it->channelArray.end(); ++channel) { printf("\n Channel Name=%s",channel->channelName.c_str()); } } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar channel:String = "News Channel" ; var userName:String = "Nick" ; var deviceToken:String = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.unsubscribeDeviceToChannel(userName, channel, deviceToken, new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); trace("DeviceToken :"+pushNotification.getDeviceToken()); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); } } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Unsubscribe user’s device from push notification service.
Required Parameters
userName - Name of user whose device token has to be deleted.
deviceToken - Device token which has to be deleted.
String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.deleteDeviceToken(userName, deviceToken, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.DeleteDeviceToken(userName,devicetoken,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification success = (PushNotification) response; Console.WriteLine("success is" + success.IsResponseSuccess()); } }NSString *userName = @"Nick"; NSString *deviceToken = @"Device_Token"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService deleteDeviceToken:userName deviceToken:deviceToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let deviceToken = "1234" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.deleteDeviceToken(userName,deviceToken:deviceToken,completionBlock: { (success, response, exception) -> Void in if(success) { let app42response = response as! App42Response NSLog("%@", app42response.isResponseSuccess) NSLog("%@", app42response.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); App42Response app42response = pushNotificationService.deleteDeviceToken(userName, deviceToken); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); System.out.println("success is" + success);String userName = "userName" ; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.DeleteDeviceToken(userName, deviceToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42response = (App42Response) response; App42Log.Console("response is " + app42response) } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", deviceToken = "Device Token", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.deleteDeviceToken(userName, deviceToken, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("Response is : " + result) }, error: function(error) { } });local userName = "Nick1"; local deviceToken = "Device Token"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:deleteDeviceToken(userName,deviceToken,App42CallBack); function App42CallBack:onSuccess(object) print(object:getResponseSuccess()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick" ; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->DeleteDeviceToken(deviceToken,userName, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); App42Response success = pushNotificationService.DeleteDeviceToken(userName, deviceToken); Console.WriteLine("success is : " + success);$userName = "Nick"; $deviceToken = "Device Token"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $response = $pushNotificationService->deleteDeviceToken($userName, $deviceToken); print_r("Response is : ".$response->toString());const char* userName = "Nick" ; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->DeleteDeviceToken(deviceToken,userName, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n DeviceToken = %s",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; var deviceToken:String = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.deleteDeviceToken(userName, deviceToken, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42Response:App42Response = App42Response(response); trace("response is : "+ app42Response); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Send push message to a list of specific users.
Required Parameters
message - Message which you have to send.
userList - List of the users to which message has to be sent.
String message = "Message which you have to send"; ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); userList.add("John"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToGroup(message,userList, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is "+pushNotification.getExpiry()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String message = "Message which you have to send"; IList<String> userList = new List<String>(); userList.add("Nick"); userList.add("John"); App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToGroup(message,userList,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("Response is" + pushNotification.GetMessage()); Console.WriteLine("Response is" + pushNotification.GetExpiry()); } }NSString *message = @"Message which you have to send"; NSArray *userList = [NSArray arrayWithObjects:@"Nick",@"John", nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService sendPushMessageToGroup:userList message:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userList = ["John","Nick"] let message = "Hi All" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.sendPushMessageToGroup(userList, message:message,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.message) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String message = "Message which you have to send"; ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); userList.add("John"); App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotificationObj = pushNotificationService.sendPushMessageToGroup(message, userList); System.out.println("Message is " + pushNotificationObj.getMessage()); System.out.println("Expiry is "+pushNotificationObj.getExpiry());String message = "Message which you have to send" ; IList<String> userList = new List<String>(); userList.add("Nick"); userList.add("John"); App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToGroup(message,userList, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Message is " + pushNotification.GetMessage()); App42Log.Console("Message is " + pushNotification.GetExpiry()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var message="Message which you have to send", result ; var userList = new Array(); userList.push("Nick"); userList.push("John"); App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.sendPushMessageToGroup(message, userList, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("Message is " + result.message); console.log("Expiry is " + result.expiry); }, error: function(error) { } });local message="Message which you have to send" local userList={} userList[1]="Nick"; userList[2]="John"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:sendPushMessageToGroup(message,userList,App42CallBack); function App42CallBack:onSuccess(object) print("Message is "..object:getMessage()); print("Expiry is "..object:getExpiry()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* message = "Message which you have to send"; std::vector<std::string>userList; userList.push_back("Nick"); userList.push_back("John"); PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToGroup(userList, message, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String message = "Message which you have to send"; IList<String> userList = new List<String>(); userList.add("Nick"); userList.add("John"); App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotificationObj = pushNotificationService.SendPushMessageToGroup(message, userList); Console.WriteLine(pushNotificationObj.GetMessage()); Console.WriteLine(pushNotificationObj.GetExpiry());$message = "Message which you have to send"; $userList= array(); array_push($userList, "Nick"); array_push($userList, "John"); App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToGroup($message, $userList); print_r("Message Is :" . $pushNotification->getMessage()); print_r("Expiry Is :" . $pushNotification->getExpiry());const char* message = "Message which you have to send"; std::vector<std::string>userList; userList.push_back("Nick"); userList.push_back("John"); PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToGroup(userList, message, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar message:String = "Message which you have to send"; var userList:Array = new Array(); userList.push("Nick"); userList.push("John"); App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToGroup(message,userList,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("Expiry is " + pushNotification.getExpiry()); trace("Message is " + pushNotification.getMessage()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Schedule messages for a particular user.
Required Parameters
userName - Name of the user to whom you want to send the message.
message - Message which you have to send.
scheduleDate - Time at which the messsage has to be sent.
String message = "Message which you have to send"; Date scheduleDate = null; /* Get date from your source */ String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.scheduleMessageToUser(userName, message, scheduleDate, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("Username is " +pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is "+pushNotification.getExpiry()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String message = "Message which you have to send"; DateTime scheduleDate = null; /* Get date from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.ScheduleMessageToUser(userName, message, scheduleDate, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("Username is " + pushNotification.GetUserName()); Console.WriteLine("Message is " + pushNotification.GetMessage()); Console.WriteLine("Expiry is " + pushNotification.GetExpiry()); } }NSDate *expiry = [NSDate date]; NSString *userName = @"Nick"; NSString *message = @"Message which you have to send"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService scheduleMessageToUser:userName expiryDate:expiry message:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Coming SoonString userName = "Nick"; String message = "Message which you have to send"; Date scheduleDate = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.scheduleMessageToUser(userName, message, scheduleDate); System.out.println("Username is " +pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is "+pushNotification.getExpiry());String userName = "Nick"; String message = "Message which you have to send"; DateTime scheduleDate = null; /* Get date from your source */ App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.ScheduleMessageToUser(userName, message, scheduleDate, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Username is " +pushNotification.GetUserName()); App42Log.Console("Message is " + pushNotification.GetMessage()); App42Log.Console("Expiry is " + pushNotification.GetExpiry()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var message = "Message which you have to send", scheduleDate = null, /* Get date from your source */ userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.scheduleMessageToUser(userName, message, scheduleDate, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("Message is " + result.message); console.log("Expiry is " + result.expiry); }, error: function(error) { } });Coming Soonconst char* userName = "Nick"; const char* message = "Message which you have to send"; tm *expiryDate; time_t t = time(NULL); expiryDate = gmtime(&t); PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->ScheduleMessageToUser(userName, message, expiryDate, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; String message = "Message which you have to send"; DateTime scheduleDate = null; /* Get date from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.ScheduleMessageToUser(userName, message, scheduleDate); Console.WriteLine("Username is " +pushNotification.GetUserName()); Console.WriteLine("Message is " +pushNotification.GetMessage()); Console.WriteLine("Expiry is "+pushNotification.GetExpiry());$userName = "Nick"; $message = "Message which you have to send"; $date = date(DATE_ATOM, mktime()); $date2 = strtotime($date); $newdate = strtotime('+2 day', strtotime($date)); $scheduleDate = date('Y-m-j', $date2); App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->scheduleMessageToUser($userName,$message,$scheduleDate); print_r("Username is " .$pushNotification->getUserName()); print_r("Message is " .$pushNotification->getMessage()); print_r("Expiry is ".$pushNotification->getExpiry());const char* userName = "Nick"; const char* message = "Message which you have to send"; tm *expiryDate; time_t t = time(NULL); expiryDate = gmtime(&t); PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->ScheduleMessageToUser(userName, message, expiryDate, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar message:String = "Message which you have to send"; var scheduleDate:Date= null; /* Get date from your source */ var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.scheduleMessageToUser(userName,message,scheduleDate, new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); trace("Expiry is " + pushNotification.getExpiry()); trace("Message is " + pushNotification.getMessage()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Send multilingual(UTF-8) push message to a particular user.
Note: Same can done for sending push methods.
Required Parameters
userName - Name of the user to whom you want to send the message.
message - Message which you want to send.
String userName = "Nick"; String message = "Message which you have to send"; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("dataEncoding", "true"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.setOtherMetaHeaders(otherMetaHeaders); pushNotificationService.sendPushMessageToUser(userName, message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is"+pushNotification.getExpiry()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String message = "Message which you have to send"; Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("dataEncoding", "true"); App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SetOtherMetaHeaders(otherMetaHeaders); pushNotificationService.SendPushMessageToUser(userName,message,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }NSString *userName= @"Nick"; NSString *message = @"Message which you have to send"; NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"true",@"dataEncoding", nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService setOtherMetaHeaders:dict]; [pushNotificationService sendPushMessageToUser:userName message:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSLog(@"Expiry=%@",pushNotification.expiry); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let message = "Hi All" let expiryDate = NSDate() App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.scheduleMessageToUser(userName,expiryDate:expiryDate,message:message,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.message) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String message = "Message which you have to send"; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("dataEncoding", "true"); App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.setOtherMetaHeaders(otherMetaHeaders); PushNotification pushNotification = pushNotificationService.sendPushMessageToUser(userName,message); System.out.println("userName is " + pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is"+pushNotification.getExpiry()); String jsonResponse = pushNotification.toString();String userName = "Nick"; String message = "Message which you have to send"; App42Log.SetDebug(true); //Print output in your editor console Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("dataEncoding", "true"); App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SetOtherMetaHeaders(otherMetaHeaders); pushNotificationService.SendPushMessageToUser(userName,message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("Message is " + pushNotification.GetMessage()); App42Log.Console("userName is : " + pushNotification.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", message = "Message which you have to send", result ; var otherMetaHeaders={dataEncoding:true}; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.setOtherMetaHeaders(otherMetaHeaders); pushNotificationService.sendPushMessageToUser(userName, message, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName); console.log("Message is : " + result.message) console.log("Expiry is : " + result.expiry) }, error: function(error) { } });local userName = "Nick"; local message = "Message which you have to send"; local App42CallBack = {} local otherMetaHeaders = {}; otherMetaHeaders.dataEncoding= "true"; App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:setOtherMetaHeaders(otherMetaHeaders); pushNotificationService:sendPushMessageToUser(userName,message,App42CallBack); function App42CallBack:onSuccess(object) print("Message is "..object:getMessage()); print("Message is "..object:getExpiry()); print("UserName is "..object:getUserName()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endconst char* userName = "Nick"; const char* message = "Message which you have to send"; map<string,string> otherMetaHeaders; otherMetaHeaders["dataEncoding"] = "true"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->setOtherMetaHeaders(otherMetaHeaders); pushService->SendPushMessageToUser(userName,message,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; String message = "Message which you have to send"; Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("dataEncoding", "true"); App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SetOtherMetaHeaders(otherMetaHeaders); PushNotification pushNotification = pushNotificationService.SendPushMessageToUser(userName,message); Console.WriteLine("userName is " + pushNotification.GetUserName()); Console.WriteLine("message is " + pushNotification.GetMessage()); String jsonResponse = pushNotification.ToString();$userName = "Nick"; $message = "Message which you have to send"; $otherMetaHeaders = array(); $otherMetaHeaders['dataEncoding'] ="true"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotificationService->setOtherMetaHeaders($otherMetaHeaders); $pushNotification = $pushNotificationService->sendPushMessageToUser($userName,$message); print_r("Message is :".$pushNotification->getMessage()); print_r("Expiry is :".$pushNotification->getExpiry()); print_r("UserName is :".$pushNotification->getUserName()); $jsonResponse = $pushNotification->toString();const char* userName = "Nick"; const char* message = "Message which you have to send"; map<string,string> otherMetaHeaders; otherMetaHeaders["dataEncoding"] = "true"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->setOtherMetaHeaders(otherMetaHeaders); pushService->SendPushMessageToUser(userName,message,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n Expiry=%s\n",it->expiry.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; var message:String = "Message which you have to send"; var otherMetaHeaders:Dictionary = new Dictionary(); otherMetaHeaders["dataEncoding"] = "true"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.setOtherMetaHeaders(otherMetaHeaders); pushNotificationService.sendPushMessageToUser(userName,message,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); trace("Expiry is " + pushNotification.getExpiry()); trace("Message is " + pushNotification.getMessage()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Unsubscribe device from push notification. The user will not receive any future push notifications.
Required Parameters
userName - Name of the user whom you want to unsubscribe from push notifications.
deviceToken - Device token which you want to unsubscribe.
String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.unsubscribeDevice(userName, deviceToken, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("DeviceToken is " + pushNotification.getDeviceToken()); System.out.println("Type is "+ pushNotification.getType()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UnsubscribeDevice(userName, deviceToken, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("UserName is : " + pushNotification.GetUserName()); Console.WriteLine("DeviceToken is : " + pushNotification.GetDeviceToken()); Console.WriteLine("Type is " + pushNotification.GetType()); } }NSString *userName = @"Nick"; NSString *deviceToken = @"Device Token"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService unsubscribeDeviceForUser:userName deviceToken:deviceToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let deviceToken = "1234" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.unsubscribeDeviceForUser(userName, deviceToken:deviceToken,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.userName) NSLog("%@", pushNotification.deviceToken) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.unsubscribeDevice(userName, deviceToken); System.out.println("userName is " + pushNotification.getUserName()); System.out.println("DeviceToken is " + pushNotification.getDeviceToken()); System.out.println("Type is "+ pushNotification.getType());String userName = "Nick"; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UnsubscribeDevice(userName,deviceToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("UserName is : " + pushNotification.GetUserName()); App42Log.Console("DeviceToken is : " + pushNotification.GetDeviceToken()); App42Log.Console("Type is " + pushNotification.GetType()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", deviceToken = "Device Token", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.unsubscribeDevice(userName, deviceToken, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) console.log("Type is : " + result.type); console.log("DeviceToken is : " + result.deviceToken); }, error: function(error) { } });local userName = "Nick"; local deviceToken = "Device Token"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:unsubscribeDevice(userName,deviceToken,App42CallBack); function App42CallBack:onSuccess(object) print("DeviceToken is : "..object:getDeviceToken()); print("Type is " ..object:getType()); print("UserName is "..object:getUserName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->UnsubscribeDevice(deviceToken, userName,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s\n",it->type.c_str()); printf("\n DeviceToken=%s\n",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.UnsubscribeDevice(userName, deviceToken); Console.WriteLine("UserName is " +pushNotification.GetUserName()); Console.WriteLine("Message is " +pushNotification.GetMessage()); Console.WriteLine("Type is " + pushNotification.GetType());$userName ="Nick"; $deviceToken = "Device Token"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->unsubscribeDevice($userName,$deviceToken); print_r("UserName is " . $pushNotification->getUserName()); print_r("Type is " . $pushNotification->getType()); print_r("DeviceToken is " . $pushNotification->getDeviceToken()); $jsonResponse = $pushNotification->toString();const char* userName = "Nick"; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->UnsubscribeDevice(deviceToken, userName,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s\n",it->type.c_str()); printf("\n DeviceToken=%s\n",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; var deviceToken:String = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.unsubscribeDevice(userName, deviceToken); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("UserName is " + pushNotification.getUserName()); trace("Type is " + pushNotification.getType()); trace("DeviceToken is " + pushNotification.getDeviceToken()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Resubscribe device from push notification that was unsubscribed.
Required Parameters
userName - Name of the user who you want to resubscribe to push notifications.
deviceToken - Device token which you want to resubscribe.
String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.resubscribeDevice(userName, deviceToken, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("DeviceToken is " + pushNotification.getDeviceToken()); System.out.println("Type is "+ pushNotification.getType()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.ReSubscribeDevice(userName, deviceToken, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("UserName is : " + pushNotification.GetUserName()); Console.WriteLine("DeviceToken is : " + pushNotification.GetDeviceToken()); Console.WriteLine("Type is " + pushNotification.GetType()); } }NSString *userName = @"Nick"; NSString *deviceToken = @"Device Token"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService resubscribeDeviceForUser:userName deviceToken:deviceToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let deviceToken = "1234" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.resubscribeDeviceForUser(userName,deviceToken:deviceToken,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.userName) NSLog("%@", pushNotification.deviceToken) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.resubscribeDevice(userName, deviceToken); System.out.println("userName is " + pushNotification.getUserName()); System.out.println("DeviceToken is " + pushNotification.getDeviceToken()); System.out.println("Type is "+ pushNotification.getType());String userName = "Nick"; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.ReSubscribeDevice(userName,deviceToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("UserName is : " + pushNotification.GetUserName()); App42Log.Console("DeviceToken is : " + pushNotification.GetDeviceToken()); App42Log.Console("Type is " + pushNotification.GetType()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", deviceToken = "Device Token", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.resubscribeDevice(userName, deviceToken, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) console.log("Type is : " + result.type); console.log("DeviceToken is : " + result.deviceToken); }, error: function(error) { } });local userName = "Nick"; local deviceToken = "Device Token"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:resubscribeDevice(userName,deviceToken,App42CallBack); function App42CallBack:onSuccess(object) print("DeviceToken is : "..object:getDeviceToken()); print("Type is " ..object:getType()); print("UserName is "..object:getUserName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->ResubscribeDevice(deviceToken, userName,app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s\n",it->type.c_str()); printf("\n DeviceToken=%s\n",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.ReSubscribeDevice(userName, deviceToken); Console.WriteLine("UserName is " +pushNotification.GetUserName()); Console.WriteLine("Message is " +pushNotification.GetMessage()); Console.WriteLine("Type is " + pushNotification.GetType());$userName ="Nick"; $deviceToken = "Device Token"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->resubscribeDevice($userName,$deviceToken); print_r("UserName is " . $pushNotification->getUserName()); print_r("Type is " . $pushNotification->getType()); print_r("DeviceToken is " . $pushNotification->getDeviceToken()); $jsonResponse = $pushNotification->toString();const char* userName = "Nick"; const char* deviceToken = "Device Token"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->ResubscribeDevice(deviceToken, userName,this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s\n",it->type.c_str()); printf("\n DeviceToken=%s\n",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; var deviceToken:String = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.resubscribeDevice(userName, deviceToken); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("UserName is " + pushNotification.getUserName()); trace("Type is " + pushNotification.getType()); trace("DeviceToken is " + pushNotification.getDeviceToken()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Delete all devices of a particular user.
Required Parameters
userName - Name of the user of whom you want to delete the devices.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.deleteAllDevices(userName,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message " + ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.DeleteAllDevices(userName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42response = (App42Response) response; Console.WriteLine("App42Response is : " + app42response.ToString()); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService deleteAllDevices:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.deleteAllDevices(userName,completionBlock: { (success, response, exception) -> Void in if(success) { let app42response = response as! App42Response NSLog("%@", app42response.isResponseSuccess) NSLog("%@", app42response.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); App42Response app42response = pushNotificationService.deleteAllDevices(userName); System.out.println("response is " + app42response) ;String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.DeleteAllDevices(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42response = (App42Response) response; App42Log.Console("App42Response is : " + app42response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.deleteAllDevices(userName, message, { success: function(object) { var pushNotification = JSON.parse(object); console.log("Response is "+pushNotification) }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:deleteAllDevices(userName,App42CallBack); function App42CallBack:onSuccess(object) print(object:getResponseSuccess()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->DeleteAllDevices(userName, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n DeviceToken=%s\n",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); App42Response app42response = pushNotificationService.DeleteAllDevices(userName); Console.WriteLine("App42Response is : " + app42response.ToString());$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $response = $pushNotificationService->deleteAllDevices($userName); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();const char* userName = "Nick"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->DeleteAllDevices(userName, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { for(std::vector<App42PushNotification>::iterator it = pushResponse->notifications.begin(); it != pushResponse->notifications.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n DeviceToken=%s\n",it->deviceToken.c_str()); } } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.deleteAllDevices(userName,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Send push message to a particular device.
Required Parameters
userName - Name of the user to whom you want to send the message.
deviceToken - Name of the device token with which you want to send the message.
message - Message which you have to send.
String userName = "Nick"; String message = "Message which you have to send"; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToDevice(userName,deviceToken, message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is"+pushNotification.getExpiry()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String message = "Message which you have to send"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToDevice(userName, deviceToken, message, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("Message is " + pushNotification.GetMessage()); Console.WriteLine("Expiry is " + pushNotification.GetExpiry()); } }NSString *deviceToken = @"Device Token"; NSString *userName = @"Nick"; NSString *message = @"Message which you have to send"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService sendPushMessageToDevice:deviceToken userName:userName message:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"message is %@" , pushNotification.message); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let deviceToken = "1234" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.sendPushMessageToDevice(deviceToken,userName:userName,message:"Hi Testing ios",completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.message) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String message = "Message which you have to send"; String deviceToken = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.sendPushMessageToDevice(userName,deviceToken, message); System.out.println("userName is " + pushNotification.getUserName()); System.out.println("Message is " + pushNotification.getMessage()); System.out.println("Expiry is"+pushNotification.getExpiry());String userName = "Nick"; String message = "Message which you have to send"; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToDevice(userName, deviceToken, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("userName is " + pushNotification.GetUserName()); App42Log.Console("Message is " + pushNotification.GetMessage()); App42Log.Console("Expiry is"+pushNotification.GetExpiry()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", message = "Message which you have to send", deviceToken = "Device Token", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.sendPushMessageToDevice(userName,deviceToken,message, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName); console.log("Message is : " + result.message) console.log("Expiry is : " + result.expiry) }, error: function(error) { } });local userName = "Nick"; local message = "Message which you have to send"; local deviceToken = "Device Token"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:sendPushMessageToDevice(userName,deviceToken,message,App42CallBack); function App42CallBack:onSuccess(object) print("Message is "..object:getMessage()); print("Expiry is "..object:getExpiry()); print("UserName is "..object:getUserName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endComing SoonString userName = "Nick"; String message = "Message which you have to send"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.SendPushMessageToDevice(userName, message, deviceToken); Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("Message is " + pushNotification.GetMessage()); Console.WriteLine("Expiry is"+pushNotification.GetExpiry());$userName ="Nick"; $deviceToken = "Device Token"; $message = "Message which you have to send"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToDevice($userName,$deviceToken,$message); print_r("UserName is " .$pushNotification->getUserName()); print_r("Message is ".$pushNotification->getMessage()); print_r("Expiry is".$pushNotification->getExpiry());Not AvailableComing Soonvar userName:String = "Nick"; var deviceToken:String = "Device Token"; var message:String = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToDevice(userName,deviceToken, message,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("userName is " + pushNotification.getUserName()); trace("Expiry is " + pushNotification.getExpiry()); trace("Message is " + pushNotification.getMessage()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
This method is used to update push badge count of a particular device registered by a user.
Required Parameters
userName - Name of the user of whom you want to update the badge count.
deviceToken - Device token which you want to update the badge count.
badges - Number of badge count you want to update.
String userName = "Nick"; String deviceToken = "Device Token"; int badges= 5; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.updatePushBadgeforDevice(userName,deviceToken, badges, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("DeviceToken :"+pushNotification.getDeviceToken()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String deviceToken = "Device Token"; int badges= 5; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UpdatePushBadgeforDevice(userName, deviceToken, badges, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("Message is " + pushNotification.GetMessage()); Console.WriteLine("Expiry is " + pushNotification.GetExpiry()); } }NSString *deviceToken = @"Device Token"; NSString *userName = @"Nick"; int badge = 5; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService updatePushBadgeforDevice:deviceToken userName:userName badges:badge completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSLog(@"Device Token=%@",pushNotification.deviceToken); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let deviceToken = "1234" let badges:Int32 = 10 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.updatePushBadgeforDevice(deviceToken, userName:userName, badges:badges, completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.userName) NSLog("%@", pushNotification.deviceToken) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String deviceToken = "Device Token"; int badges= 5; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.updatePushBadgeforDevice(userName,deviceToken, badges); System.out.println("UserName is :" + pushNotification.getUserName()); System.out.println("DeviceToken :"+pushNotification.getDeviceToken());String userName = "Nick"; String deviceToken = "Device Token"; int badges= 5; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UpdatePushBadgeforDevice(userName, deviceToken, badges, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("userName is " + pushNotification.GetUserName()); App42Log.Console("DeviceToken :"+pushNotification.GetDeviceToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", deviceToken = "Device Token", badges= 5, result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.updatePushBadgeforDevice(userName,deviceToken,badges, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) console.log("DeviceToken is : " + result.deviceToken); }, error: function(error) { } });local userName = "Nick"; local deviceToken = "Device Token"; local badges= 5; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushService:updatePushBadgeforDevice(userName,deviceToken,badges, App42CallBack); function App42CallBack:onSuccess(object) print("Device Token is "..object:getDeviceToken()); print("UserName is "..object:getUserName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endComing SoonString userName = "Nick"; String deviceToken = "Device Token"; int badges= 5; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.UpdatePushBadgeforDevice(userName, deviceToken, badges); Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("DeviceToken :"+pushNotification.GetDeviceToken());$userName = "Nick" ; $deviceToken = "Device Token"; $badges=5; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->updatePushBadgeforDevice($userName, $deviceToken, 5); print_r("User Name : ".$pushNotification->getUserName()); print_r("DeviceToken :".$pushNotification->getDeviceToken());Not AvailableComing Soonvar userName:String = "Nick" ; var deviceToken:String = "Device Token"; var badges:int=5; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.updatePushBadgeforDevice(userName, deviceToken,badges,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); trace("DeviceToken :"+pushNotification.getDeviceToken()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
This method is used to update the push badge count of all the devices that a user procures. In this case, we are assuming that the user has multiple devices registered under his name.
Required Parameters
userName - Name of the user of whom you want to update the badge count.
badges - Number of badge count you want to update.
String userName = "Nick"; int badges= 5; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.updatePushBadgeforUser(userName, badges, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; int badges= 5; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UpdatePushBadgeforUser(userName, badges, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("Message is " + pushNotification.GetMessage()); Console.WriteLine("Expiry is " + pushNotification.GetExpiry()); } }NSString *userName = @"Nick"; int badges = 5; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService updatePushBadgeforUser:userName badges:badges completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSLog(@"userName is %@" , pushNotification.userName); NSString *jsonResponse = [pushNotification toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let badges:Int32 = 10 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService pushNotificationService?.updatePushBadgeforUser(userName,badges:badges,completionBlock: { (success, response, exception) -> Void in if(success) { let pushNotification = response as! PushNotification NSLog("%@", pushNotification.userName) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; int badges= 5; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.updatePushBadgeforUser(userName, badges); System.out.println("UserName is :" + pushNotification.getUserName());String userName = "Nick"; int badges= 5; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.UpdatePushBadgeforUser(userName, badges, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("userName is " + pushNotification.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", badges= 5, result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.updatePushBadgeforUser(userName,badges, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) }, error: function(error) { } });local userName = "Nick"; local badges= 5; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:updatePushBadgeforUser(userName,badges,App42CallBack); function App42CallBack:onSuccess(object) print("UserName is "..object:getUserName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endComing SoonString userName = "Nick"; int badges= 5; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.UpdatePushBadgeforUser(userName, badges); Console.WriteLine("UserName is " + pushNotification.GetUserName());$userName = "Nick" ; $badges=5; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->updatePushBadgeforUser($userName,5); print_r("User Name : ".$pushNotification->getUserName());Not AvailableComing Soonvar userName:String = "Nick" ; var badges:int=5; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.updatePushBadgeforUser(userName,badges,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
This method is used to reset push badge count to 0 of a particular device registered by the user .
Required Parameters
userName - Name of the user of whom you want to clear the badge count.
deviceToken - Device token which you want to clear the badge count.
String userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.clearAllBadgeCount(userName,deviceToken, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("userName is " + pushNotification.getUserName()); System.out.println("DeviceToken :"+pushNotification.getDeviceToken()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.ClearAllBadgeCount(userName, deviceToken, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("DeviceToken :"+pushNotification.GetDeviceToken()); } }Coming SoonComing SoonString userName = "Nick"; String deviceToken = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.clearAllBadgeCount(userName,deviceToken); System.out.println("UserName is :" + pushNotification.getUserName()); System.out.println("DeviceToken :"+pushNotification.getDeviceToken());String userName = "Nick"; String deviceToken = "Device Token"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.ClearAllBadgeCount(userName, deviceToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console("userName is " + pushNotification.GetUserName()); App42Log.Console("DeviceToken :"+pushNotification.GetDeviceToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", deviceToken = "Device Token", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.clearAllBadgeCount(userName, deviceToken, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push; console.log("UserName is : " + result.userName) console.log("DeviceToken is : " + result.deviceToken); }, error: function(error) { } });local userName = "Nick"; local deviceToken = "Device Token"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:clearAllBadgeCount(userName,deviceToken, App42CallBack); function App42CallBack:onSuccess(object) print("Device Token is "..object:getDeviceToken()); print("UserName is "..object:getUserName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endComing SoonString userName = "Nick"; String deviceToken = "Device Token"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.ClearAllBadgeCount(userName, deviceToken); Console.WriteLine("UserName is " + pushNotification.GetUserName()); Console.WriteLine("DeviceToken :"+pushNotification.GetDeviceToken());$userName = "Nick" ; $deviceToken = "Device Token"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->clearAllBadgeCount($userName, $deviceToken); print_r("User Name : ".$pushNotification->getUserName()); print_r("DeviceToken :".$pushNotification->getDeviceToken());Not AvailableComing Soonvar userName:String = "Nick" ; var deviceToken:String = "Device Token"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.clearAllBadgeCount(userName, deviceToken,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); trace("DeviceToken :"+pushNotification.getDeviceToken()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Delete a particular channel from app.
Required Parameters
channelName - Name of the channel which you want to delete.
String channelName = "News Channel"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.deleteChannel(channelName,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message " + ex.getMessage()); } });String channelName = "News Channel"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.DeleteChannel(channelName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is " + app42Response.ToString()); } }NSString *channelName = @"News Channel"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushService deleteChannel:channelName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *app42Response = (App42Response*)responseObj; NSLog(@"isResponseSuccess=%d",app42Response.isResponseSuccess); NSLog(@"Response=%@",app42Response.strResponse); [self showResponse:app42Response.strResponse]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP Error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); [self showResponse:[exception reason]]; } }];let channel = "News Channel" pushNotificationService?.deleteChannel(channel,completionBlock: { (success, response, exception) -> Void in App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let pushNotificationService = App42API.buildPushService() as? PushNotificationService if(success) { let app42response = response as! App42Response NSLog("%@", app42response.isResponseSuccess) NSLog("%@", app42response.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String channelName = "News Channel"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); App42Response app42response = pushNotificationService.deleteChannel(channelName); System.out.println(app42response);String channelName = "News Channel"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.DeleteChannel(channelName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("App42Response is " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channelName = "News Channel", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.deleteChannel(channelName, { success: function(object) { var pushNotification = JSON.parse(object); console.log("Response is "+pushNotification) }, error: function(error) { } });local channelName = "News Channel"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:deleteChannel(channelName, App42CallBack); function App42CallBack:onSuccess(object) print("Response is : "..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endNot AvailableString channelName = "News Channel"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); App42Response app42Response = pushNotificationService.DeleteChannel(channelName); Console.WriteLine("App42Response is " + app42Response.ToString());$channelName = "News Channel"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $app42Response = $pushNotificationService->deleteChannel($channelName); print_r("App42Response is " .$app42Response->toString());Not AvailableNot Availablevar channelName:String = "News Channel"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.deleteChannel(channalName, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Get the count of the users who are subscribed to a particular channel.
Required Parameters
channelName - Name of channel of which you want to get the count.
String channelName = "News Channel"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getChannelUsersCount(channelName, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Total Records : " + app42response.getTotalRecords()) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channelName = "News Channel"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetChannelUsersCount(channelName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is " + app42Response.ToString()); Console.WriteLine("TotalRecords " + app42Response.GetTotalRecords()); } }Not AvailableComing SoonString channelName = "News Channel"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); App42Response app42response = pushNotificationService.getChannelUsersCount(channelName); System.out.println("Total Records : " + app42response.getTotalRecords());String channelName = "News Channel"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetChannelUsersCount(channelName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("App42Response is : " + app42Response.ToString()); App42Log.Console("TotalRecords : " + app42Response.GetTotalRecords()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channelName = "News Channel", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.getChannelUsersCount(channelName, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response; console.log("Total records : " + result.totalRecords); }, error: function(error) { } });local channelName = "News Channel"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:getChannelUsersCount(channelName, App42CallBack); function App42CallBack:onSuccess(object) print("Response is : "..object:getStrResponse()); print("Total record is "..object:getTotalRecords()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endNot AvailableString channelName = "News Channel"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); App42Response app42Response = pushNotificationService.GetChannelUsersCount(channelName); Console.WriteLine("App42Response is " + app42Response.ToString()); Console.WriteLine("TotalRecords : " + app42Response.GetTotalRecords());$channelName = "News Channel"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $app42Response = $pushNotificationService->getChannelUsersCount($channelName); print_r("App42Response is " .$app42Response->toString()); print_r("TotalRecords : ".$app42Response->getTotalRecords());Not AvailableNot Availablevar channelName:String = "News Channel"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getChannelUsersCount(channalName, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("Total Records is " + app42response.getTotalRecords()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Get the users list for a particular channel by paging.
Required Parameters
channelName - Name of channel of which you want to get users.
max - Maximum number of users to be fetched.
offset - From where the users are to be fetched.
String channelName = "News Channel"; int max = 1; int offset = 0 ; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getChannelUsers(channelName,max,offset, new App42CallBack() { public void onSuccess(Object response) { ArrayList<PushNotification> pushNotification = (ArrayList<PushNotification>)response; for(int i=0 ; i<pushNotification.size();i++) { System.out.println("user name is " + pushNotification.get(i).getUserName()); System.out.println("device token is " + pushNotification.get(i).getDeviceToken()); System.out.println("type is " + pushNotification.get(i).getType()); ArrayList<PushNotification.Channel> channelList = pushNotification.get(i).getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String channelName = "News Channel"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetChannelUsers(channelName, max, offset, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<PushNotification> pushNotification = (IList<PushNotification>) response; for (int i=0; i<pushNotification.Count; i++) { Console.WriteLine("UserName : " + pushNotification[i].GetUserName()); } } }Not AvailableComing SoonString channelName = "News Channel"; int max = 1; int offset = 0 ; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); ArrayList<PushNotification> pushNotification = pushNotificationService.getChannelUsers(channelName, max,offset); for(int i=0 ; i<pushNotification.size();i++) { System.out.println("user name is " + pushNotification.get(i).getUserName()); System.out.println("device token is " + pushNotification.get(i).getDeviceToken()); System.out.println("type is " + pushNotification.get(i).getType()); ArrayList<PushNotification.Channel> channelList = pushNotification.get(i).getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } }String channelName = "News Channel"; int max = 10; int offset = 0; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetChannelUsers(channelName, max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<PushNotification> pushNotification = (IList<PushNotification>) response; for (int i=0; i<pushNotification.Count; i++) { App42Log.Console ("UserName : " + pushNotification[i].GetUserName()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var channelName = "News Channel", max = 10, offset = 0, result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.getChannelUsers(channelName, max, offset, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("Channel Name :"+result[i].channels.channel.channelName) console.log("DeviceToken : "+result[i].deviceToken) console.log(("Type : "+result[i].type) console.log("UserName : "+result[i].userName) } } else { console.log("Channel Name : "+result.channels.channel.channelName) console.log("DeviceToken : "+result.deviceToken) console.log("Type : "+result.type) console.log("UserName : "+result.userName) } }, error: function(error) { } });local channelName = "News Channel"; local max = 10; local offset = 0; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:getChannelUsers(channel ,max,offset, App42CallBack); function App42CallBack:onSuccess(object) if table.getn(object) > 1 then for i=1,table.getn(object) do print("UserName is "..object[i]:getUserName()); print("Type is "..object[i]:getType()); print("DeviceToken is "..object[i]:getDeviceToken()); print("GetName :"..object[i]:getChannelList():getName()); end else print("UserName is "..object:getUserName()); print("Type is "..object:getType()); print("DeviceToken is "..object:getDeviceToken()); print("GetName :"..object:getChannelList():getName()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endNot AvailableString channelName = "News Channel"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); IList<PushNotification> pushNotification = pushNotificationService.GetChannelUsers(channelName, max, offset); for (int i=0; i<pushNotification.Count; i++) { Console.WriteLine ("UserName : " + pushNotification[i].GetUserName()); }$channelName = "News Channel"; $max = 10; $offset = 0; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->getChannelUsers($channelName,$max, $offset); print_r("Push Notification Response is : " . $pushNotification[0]->toString()); for ($i = 0; $i < count($pushNotification); $i++) { print_r("UserName is " . $pushNotification[$i]->getUserName()); print_r("device token is " . $pushNotification[$i]->getDeviceToken()); print_r("type is " . $pushNotification[$i]->getType()); $channel = $pushNotification[$i]->getChannelList(); foreach ($channel as $channelList) { print_r("channelName is " . $channelList->getName()); } }Not AvailableNot Availablevar channelName:String = "News Channel"; var max:int = 10; var offset:int = 0; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getChannelUsers(channalName,max,offset, new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { for(var i:int = 0;i < response.length;i++) { var pushNotification:PushNotification = PushNotification(response[i]); trace("User Name : "+pushNotification.getUserName()); trace("DeviceToken :"+pushNotification.getDeviceToken()); trace("Device Type : "+pushNotification .getType()); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); } } } } public function onException(exception:App42Exception):void { trace("Response is "+exception) } }Not AvailableNot Available
Get the count of all the subscribed channels of a particular user.
Required Parameters
userName - Name of the user of whom you want to get a count of the subscribed channels.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getUserSubscribedChannelsCount(userName, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Total Records : " + app42response.getTotalRecords()) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetUserSubscribedChannelsCount (userName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is " + app42Response.ToString()); Console.WriteLine("TotalRecords " + app42Response.GetTotalRecords()); } }Not AvailableComing SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); App42Response app42Response = pushNotificationService.getUserSubscribedChannelsCount(userName); System.out.println("TotalRecords " + app42Response.getTotalRecords());String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetUserSubscribedChannelsCount (userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("App42Response is : " + app42Response.ToString()); App42Log.Console("TotalRecords " + app42Response.GetTotalRecords()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.getUserSubscribedChannelsCount(userName, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response; console.log("Total records : " + result.totalRecords); }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushService:getUserSubscribedChannelsCount(userName , App42CallBack); function callBack:onSuccess(object) print("Response is : "..object:getStrResponse()); print("Total record is "..object:getTotalRecords()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endNot AvailableString userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); App42Response app42Response = pushNotificationService.GetUserSubscribedChannelsCount (userName); Console.WriteLine("App42Response is " + app42Response.ToString()); Console.WriteLine("TotalRecords : " + app42Response.GetTotalRecords());$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $app42Response = $pushNotificationService->getUserSubscribedChannelsCount($userName); print_r("App42Response is ".$app42Response->toString()); print_r("TotalRecords : " .$app42Response->getTotalRecords());Not AvailableNot Availablevar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getUserSubscribedChannelsCount(userName, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("Total Records is " + app42response.getTotalRecords()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Get the list of subscribed channels for a particular user by paging.
Required Parameters
userName - Name of the user for whom you want to get the subscribed channels.
max - Maximum number of channels to be fetched.
offset - From where the channels are to be fetched.
String userName = "Nick"; int max = 1; int offset = 0 ; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getUserSubscribedChannels(userName,max,offset, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("UserName is " + pushNotification.getUserName()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetUserSubscribedChannels(userName, max, offset, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; Console.WriteLine ("UserName : " + pushNotification.GetUserName()); for(int i = 0 ; i < pushNotification.GetChannelList().Count; i++ ) { Console.WriteLine ("Description is : " + pushNotification.GetChannelList()[i].GetDescription()); Console.WriteLine ("Name is : " + pushNotification.GetChannelList()[i].GetName()); Console.WriteLine ("Type is : " + pushNotification.GetChannelList()[i].GetType()); } } }Not AvailableComing SoonString userName = "Nick"; int max = 1; int offset = 0 ; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); PushNotification pushNotification = pushNotificationService.getUserSubscribedChannels(userName,max,offset); System.out.println("UserName is " + pushNotification.getUserName()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); }String userName = "Nick"; int max = 10; int offset = 0; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.GetUserSubscribedChannels(userName, max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console ("UserName : " + pushNotification.GetUserName()); for(int i = 0 ; i < pushNotification.GetChannelList().Count; i++ ) { App42Log.Console ("Description is : " + pushNotification.GetChannelList()[i].GetDescription()); App42Log.Console ("Name is : " + pushNotification.GetChannelList()[i].GetName()); App42Log.Console ("Type is : " + pushNotification.GetChannelList()[i].GetType()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", max = 10, offset = 0, result; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.getUserSubscribedChannels(userName, max, offset, { success: function(object) { var pushNotification = JSON.parse(object); result = pushNotification.app42.response.push.channels.channel; if(result instanceof Array) { for(var i = 0; i<result.length; i++) { console.log("Channel Name : " + result[i].channelName) } } else console.log("Channel Name : " + result.channelName) }, error: function(error) { } });local userName = "Nick"; local max = 10; local offset = 0; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local pushNotificationService = App42API:buildPushNotificationService() pushNotificationService:getUserSubscribedChannels(userName , max,offset,App42CallBack); function App42CallBack:onSuccess(object) print("Response is :"..JSON:encode(object)); print("getStrResponse is : "..object:getStrResponse()); print("UserName is "..object:getUserName()); if table.getn(object:getChannelList()) >1 then for i=1,table.getn(object:getChannelList()) do print("Channel Name :"..object:getChannelList()[i]:getName()); end else print("Channel Name:"..object:getChannelList():getName()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endNot AvailableString userName = "Nick"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); PushNotification pushNotification = pushNotificationService.GetUserSubscribedChannels(userName, max, offset); Console.WriteLine ("UserName : " + pushNotification.GetUserName()); for(int i = 0 ; i < pushNotification.GetChannelList().Count; i++ ) { Console.WriteLine ("Description is : " + pushNotification.GetChannelList()[i].GetDescription()); Console.WriteLine ("Name is : " + pushNotification.GetChannelList()[i].GetName()); Console.WriteLine ("Type is : " + pushNotification.GetChannelList()[i].GetType()); }$userName = "Nick"; $max = 10; $offset = 0; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); $pushNotification = $pushNotificationService->getUserSubscribedChannels($userName,$max,$offset); print_r("Push Notification Response is : " . $pushNotification->toString()); print_r("UserName is " . $pushNotification->getUserName()); $channel = $pushNotification->getChannelList(); foreach($channel as $channelList) { print_r("channelName is " . $channelList->getName()); }Not AvailableNot Availablevar userName:String = "Nick"; var max:int = 10; var offset:int = 0; App42API.initialize("API_KEY","SECRET_KEY"); var pushNotificationService:PushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.getUserSubscribedChannels(userName, max,offset, new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var pushNotification:PushNotification = PushNotification(response); trace("User Name : "+pushNotification.getUserName()); if(pushNotification.getChannelList().length > 0) { for(var j:int=0;j<pushNotification.getChannelList().length;j++) { trace("Channel Name is : "+ Channel(pushNotification.getChannelList()[j]).getName()); } } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableComing Soon
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.trackPush( new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("Event is " + pushNotification.getEventName()); } public void onException(Exception ex) { System.out.println("Exception Message " + ex.getMessage()); } });Coming SoonComing SoonComing SoonComing SoonApp42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.TrackPush(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; App42Log.Console ("EventName : " + pushNotification.GetEventName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Coming SoonComing SoonComing SoonComing SoonComing SoonComing SoonComing SoonComing SoonComing SoonComing Soon
The functions available under Push Notification API can throw some exceptions in abnormal conditions. For example, if a developer is sending a message to channel which is not in database, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “1702” and the details as “Channel by the name ‘News Channel’ does not exist”.
String channelName = "News Channel"; String message = "Message which you have to send"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushMessageToChannel( channelName, message, new App42CallBack() { public void onSuccess(Object response) { PushNotification pushNotification = (PushNotification)response; System.out.println("Message is " + pushNotification.getMessage()); ArrayList<PushNotification.Channel> channelList = pushNotification.getChannelList(); for(PushNotification.Channel channelObj : channelList) { System.out.println("channelName is " + channelObj.getName()); } } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); } });String channelName = "News Channel"; String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToChannel(channelName, message, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }NSString *channelName = @"News Channel"; NSString *message = @"Message which you have to send"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; PushNotificationService *pushNotificationService = [App42API buildPushService]; [pushNotificationService SendPushMessageToChannel:channelName withMessage:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { PushNotification *pushNotification = (PushNotification*)responseObj; NSString *jsonResponse = [pushNotification toString]; } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) } else if(appErrorCode == 1705) { // Handle here for Not subscribed (User by the name '@userName' not subscribed for the channel '@channelName'.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } NSString *jsonText = exception.reason; } }];Coming SoonString channelName = "News Channel"; String message = "Message which you have to send"; App42API.initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); try { PushNotification pushNotification = pushNotificationService.sendPushMessageToChannel(channelName, message); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }`String channelName = "News Channel"; String message = "Message which you have to send"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); pushNotificationService.SendPushMessageToChannel(channelName, message,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(object response) { PushNotification pushNotification = (PushNotification) response; String jsonResponse = pushNotification.ToString(); } }var channelName = "News Channel", message = "Message which you have to send"; var appErrorCode ; App42.initialize("API_KEY","SECRET_KEY"); var pushNotificationService = new App42Push(); pushNotificationService.sendPushMessageToChannel(channelName, message, { success: function(object) { }, error: function(error) { var pushNotification = JSON.parse(object); appErrorCode = pushNotification.app42Fault.appErrorCode; if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } });Coming Soonconst char* channelName = "News Channel"; const char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToChannel(channelName, message, app42callback(Sample_Class::onPushRequestCompleted, this)); void Sample_Class::onPushRequestCompleted(void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { //Handle success Response here } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); int appErrorCode = pushResponse->appErrorCode; if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }String channelName = "News Channel"; String message = "Message which you have to send"; App42API.Initialize("API_KEY","SECRET_KEY"); PushNotificationService pushNotificationService = App42API.BuildPushnotificationService(); try { PushNotification pushNotification = pushNotificationService.SendPushMessageToChannel(channelName, message); } catch(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); }$channelName = "News Channel"; $message = "Message which you have to send"; App42API::initialize("API_KEY","SECRET_KEY"); $pushNotificationService = App42API::buildPushNotificationService(); try { $pushNotification = $pushNotificationService->sendPushMessageToChannel($channelName, $message); } catch(App42Exception $exception) { $appErrorCode = $exception->getAppErrorCode(); $httpErrorCode = $exception->getHttpErrorCode(); if($appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) } else if($appErrorCode == 1401) { // handle here for Client is not authorized } else if($appErrorCode == 1500) { // handle here for Internal Server Error } $jsonText = $exception->getMessage(); }const char* channelName = "News Channel"; const char* message = "Message which you have to send"; PushNotificationService::Initialize("API_KEY","SECRET_KEY"); PushNotificationService* pushNotificationService = PushNotificationService::getInstance(); pushService->SendPushMessageToChannel(channelName, message, this, app42callfuncND_selector(Sample_Class::onPushRequestCompleted)); void Sample_Class::onPushRequestCompleted(App42CallBack *sender, void *response) { App42PushNotificationResponse *pushResponse = (App42PushNotificationResponse*)response; printf("\ncode=%d",pushResponse->getCode()); printf("\nResponse Body=%s",pushResponse->getBody().c_str()); if (pushResponse->isSuccess) { //Handle success Response here } else { printf("\nerrordetails:%s",pushResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",pushResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",pushResponse->appErrorCode); printf("\nhttpErrorCode:%d",pushResponse->httpErrorCode); int appErrorCode = pushResponse->appErrorCode; if(appErrorCode == 1702) { // Handle here for Not Found (Channel by the name '@channelName' does not exist.) not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }Coming SoonComing SoonComing SoonNot Available
Functions in PushNotification API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
1700 - BAD REQUEST - User by the name '@userName' already registered with the device '@deviceToken'.
1701 - BAD REQUEST - Channel by the name '@channelName' already exist
1702 - NOT FOUND - Channel by the name '@channelName' does not exist.
1703 - NOT FOUND - User by the name '@userName' does not have any device registered
1704 - BAD REQUEST - User by the name '@userName' already subscribed for the channel '@channelName'
1705 - NOT FOUND - User by the name '@userName' not subscribed for any channel
1706 - NOT FOUND - No device is registered with the App
1707 - NOT FOUND - No device is Subscribed to the channel '@channelName'.
1708 - NOT FOUND - Channel by the name '@channelName' device '@deviceToken' does not subscribe.
1709 - NOT FOUND - User by the name '@userName' device token '@deviceToken' does not registered.
1710 - NOT FOUND - No device registered for user list '@userList'
1711 - NOT FOUND - No target user found for given query
1712 - NOT FOUND - In Active Users with date rnage '@startDate'and '@endDate' does not exist.
1713 - BAD REQUEST - User by the name '@userName' already unsubscribe with the device '@deviceToken'
1714 - BAD REQUEST - User by the name '@userName' already subscribe with the device '@deviceToken'
1715 - BAD REQUEST - Your previous request already in process. Please Try after sometime.