Push Notification for the App42 Cloud API’s provides a complete Push Notification Management for any Mobile or Web App. It supports Send Push Message To Channel,To User,To All.

Initialize

In order to use various functions available in a specific API, a developer has to create an instance of ServiceAPI by passing the apiKey and secretKey which will be created after the app creation from AppHQ dashboard.

Required Parameters

apiKey - The Application key given when the application was created. secretKey - The secret key corresponding to the application key given when the application was created.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");
ServiceAPI *api = [[ServiceAPI alloc]init];
api.apiKey = @"<API_KEY>";
api.secretKey = @"<SECRET_KEY>"; 
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");
Not Available
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");
$api = new ServiceAPI("API_KEY","SECRET_KEY"); 
Not Available
api = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>")  
Coming Soon 
Coming Soon

Build Service

After initialization, developer needs to call the buildXXXService method on ServiceAPI instance to get the instance of the particular API that you wish to build. For example, To build an instance of PushNotificationService, buildPushNotificationService() method needs to be called.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
PushNotificationService pushNotificationService = api.buildPushNotificationService(); 
PushNotificationService pushNotificationService = api.BuildPushnotificationService();  
PushNotificationService *pushNotificationService = [api buildPushNotificationService]; 
PushNotificationService pushNotificationService = api.buildPushNotificationService(); 
PushNotificationService pushNotificationService = api.buildPushNotificationService(); 
PushNotificationService pushNotificationService = api.BuildPushnotificationService();
Not Available
PushNotificationService pushNotificationService = api.BuildPushnotificationService(); 
$pushNotificationService = $api->buildPushNotificationService(); 
Not Available
push_notification_service = api.build_push_notification_service() 
Coming Soon 
Coming Soon

Import Statement

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
 
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.ServiceAPI;
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"   
Not Available
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.ServiceAPI;
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; 
Not Available
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.push;  
use com\shephertz\app42\paas\sdk\php\App42BadParameterException;  
use com\shephertz\app42\paas\sdk\php\App42NotFoundException;  
use com\shephertz\app42\paas\sdk\php\App42Exception;  
use com\shephertz\app42\paas\sdk\php\ServiceAPI;  
use com\shephertz\app42\paas\sdk\php\push\PushNotificationService;
include_once '../PushNotificationService.php';  
include_once '../ServiceAPI.php';  
include_once '../App42Exception.php';  
include_once '../App42NotFoundException.php';  
include_once '../App42BadParameterException.php';  
Not Available
require 'App42_Ruby_API'
Coming Soon 
Coming Soon

Store Device Token

Stores your device token on server with particular username.

Required Parameters

userName - username with which you want your device to be registered. deviceToken - device id for android phones. deviceType - type of the device like Android, iOS , WP7.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String deviceToken = "Device Token";
PushNotification pushNotification = pushNotificationService.storeDeviceToken(userName,deviceToken);   
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();   
public class Callback : App42Callback  
{  
String userName = "Nick";
String deviceToken = "Device Token";
pushNotificationService.StoreDeviceToken(userName,deviceToken,this);   
	void App42Callback.OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message");  
	}  
	void App42Callback.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";
PushNotification *pushNotification = [
storeDeviceToken:userName deviceToken:deviceToken];
NSLog(@"userName is %@" , pushNotification.userName);
NSLog(@"type is %@" ,  pushNotification.type);
NSLog(@"type is %@" ,  pushNotification.deviceToken);
NSString *jsonResponse = [pushNotification toString]; 
Not Available
String userName = "Nick";
String deviceToken = "Device Token";
PushNotification pushNotification = pushNotificationService.storeDeviceToken(userName,deviceToken,"YOUR DEVICE TYPE");   
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";
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);
	}
}
`
	  Not Available
String userName = "Nick";
String deviceToken = "Device Token";
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";
$pushNotification = $pushNotificationService->storeDeviceToken($username,$deviceToken);	
print_r("UserName is " . $pushNotification->getUserName());
print_r("Type is " . $pushNotification->getType());
print_r("DeviceToken is " . $pushNotification->getDeviceToken());
$jsonResponse = $pushNotification->toString();  
Not Available
user_name = "Nick";
device_token = "Device Token";
dtype = App42::AppTab::DeviceType.new();
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(); 
Coming Soon 
    Coming Soon 

Upload

Upload apiKey/certificate to 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.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String apikey = "api Key";
PushNotification pushNotification = pushNotificationService.uploadApiKey(apikey);    
String jsonResponse = pushNotification.toString();   
Not Available
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"Certificate" ofType:@".p12"];
NSString *password = @"******";
NSString *environment = @"development";
PushNotification pushNotification = [pushNotificationService uploadFile:password filePath:filePath environment:environment];
NSLog(@"fileName is %@" , pushNotification.fileName);
Not Available
Not Available
Not Available
`
Not Available
Not Available
Not Available
Not Available
Not Available
Coming Soon 
Coming Soon 

Create Channel For App

Create Channel for app on which user can subscribe and get the notification for that channel.

Required Parameters

channel - channel name which you want to create. description - description for that channel

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String channel = "News Channel";
String description = "Channel all about the news";
PushNotification pushNotification = pushNotificationService.createChannelForApp(channel,description);   
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
System.out.println("Description is " +  pushNotification.getChannelList().get(0).getDescription());	
String jsonResponse = pushNotification.toString();   
    public class Callback : App42Callback  
    {  
		 String channel = "News Channel";
		 String description = "Channel all about the news";
		 pushNotificationService.CreateChannelForApp(channel,description,this);   
		void App42Callback.OnException(App42Exception exception)  
		{  
			Console.WriteLine("Exception : "+ exception);  
		}  
		void App42Callback.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";
PushNotification pushNotification = [pushNotificationService createChannelForApp:channel description:description];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
String channel = "News Channel";
String description = "Channel all about the news";
PushNotification pushNotification = pushNotificationService.createChannelForApp(channel,description);   
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
System.out.println("Description is " +  pushNotification.getChannelList().get(0).getDescription());	
String jsonResponse = pushNotification.toString();   
String channel = "News Channel";
String description = "Channel all about the news";
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);
	}
}
`
Not Available
String channel = "News Channel";
String description = "Channel all about the news";
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";
$pushNotification = $pushNotificationService->createChannelForApp($channel,$description);    
print_r("channelName is " . $pushNotification->getChannelList()[0]->getName());
print_r("Description is " .  $pushNotification->getChannelList()[0]->getDescription());	
$jsonResponse = $pushNotification->toString();  
Not Available
channel = "newsChannel";
description = "channel all about the news";
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();
Coming Soon 
    Coming Soon 

Subscribe To Channel

Selected User Will Be Subscribe To The Existing Channel.

Required Parameters

channel - channel name which you want to create. userName - UserName which want to subscribe.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String channel = "News Channel";
String userName = "Nick";
PushNotification pushNotification = pushNotificationService.subscribeToChannel(channel,userName); 
System.out.println("userName is " +  pushNotification.getUserName());	  
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
public class Callback : App42Callback  
{  
String channel = "News Channel";
String userName = "Nick";
pushNotificationService.SubscribeToChannel(channel,userName,this);   
	void App42Callback.OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message");  
	}  
	void App42Callback.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";
PushNotification pushNotification = [pushNotificationService subscribeToChannel:channel userName:userName];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
String channel = "News Channel";
String userName = "Nick";
PushNotification pushNotification = pushNotificationService.subscribeToChannel(channel,userName);  
System.out.println("userName is " +  pushNotification.getUserName());	 
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
String channel = "News Channel";
String userName = "Nick";
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);
	}
}
`
Not Available
String channel = "News Channel";
String userName = "Nick";
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";
$pushNotification = $pushNotificationService->subscribeToChannel($channelName,$userName);    
print_r("channelName is " . $pushNotification->getChannelList()[0]->getName());
print_r("userName is " .  $pushNotification->getUserName());	
Not Available
channel_name = "newsChannel";
user_name = "Nick";
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}";
end
Coming Soon 
Coming Soon 

Unsubscribe From Channel

Selected User Will Be Unsubscribe From The Existing Channel.

Required Parameters

channel - ChanneName form which you want to unsubscribe. userName - Name of user which you want to Unsubscribe.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String channel = "News Channel";
String userName = "Nick";
PushNotification pushNotification = pushNotificationService.unsubscribeFromChannel(channel,userName);  
System.out.println("userName is " +  pushNotification.getUserName()); 
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
public class Callback : App42Callback  
{  
String channel = "News Channel";
String userName = "Nick";
pushNotificationService.UnsubscribeFromChannel(channel,userName,this);   
	void App42Callback.OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message");  
	}  
	void App42Callback.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";
PushNotification pushNotification = [pushNotificationService unsubscribeFromChannel:channel userName:userName];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
String channel = "News Channel";
String userName = "Nick";
PushNotification pushNotification = pushNotificationService.unsubscribeFromChannel(channel,userName);  
System.out.println("userName is " +  pushNotification.getUserName());	 
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
String channel = "News Channel";
String userName = "Nick";
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);
	}
}
`
Not Available
String channel = "News Channel";
String userName = "Nick";
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";
$pushNotification = $pushNotificationService->unsubscribeFromChannel($channelName,$userName);    
print_r("channelName is " . $pushNotification->getChannelList()[0]->getName());
print_r("userName is " .  $pushNotification->getUserName());	
Not Available
channel_name = "newsChannel";
user_name = "Nick";
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(); 
Coming Soon 
Coming Soon 

Send Push Message To Channel

Push Message To Channel Only.

Required Parameters

channel - channel name which you want to create. message - Push message in string format.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String channel = "News Channel";
String message  = "Message which you have to send";
PushNotification pushNotification = pushNotificationService.sendPushMessageToChannel(channel,message);   
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
System.out.println("message is " +  pushNotification.getMessage());	
String jsonResponse = pushNotification.toString();   
public class Callback : App42Callback  
{  
String channel = "News Channel";
String message  = "Message which you have to send";
pushNotificationService.SendPushMessageToChannel(channel,message,this);   
	void App42Callback.OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message");  
	}  
	void App42Callback.OnSuccess(Object response)  
	{  
		PushNotification pushNotification = (PushNotification) response;     
		String jsonResponse = pushNotification.ToString();  
	}  
}  
NSString *channel = @"News Channel";
NSString *message  = @"Message which you have to send";
PushNotification pushNotification = [pushNotificationService sendPushMessageToChannel:channel withMessage:message];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
String channel = "News Channel";
String message  = "Message which you have to send";
PushNotification pushNotification = pushNotificationService.sendPushMessageToChannel(channel,message);   
System.out.println("channelName is " + pushNotification.getChannelList().get(0).getName());
System.out.println("message is " +  pushNotification.getMessage());	
String jsonResponse = pushNotification.toString();   
String channel = "News Channel";
String message  = "Message which you have to send";
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("cahnnel is : " + pushNotification.GetChannelList()[0].GetName());
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
`
Not Available
String channel = "News Channel";
String message  = "Message which you have to send";
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";
$pushNotification = $pushNotificationService->sendPushMessageToChannel($channelName,$message);    
print_r("channelName is " . $pushNotification->getChannelList()[0]->getName());
print_r("message is " .  $pushNotification->getMessage());	
$jsonResponse = $pushNotification->toString();  
Not Available
channel = "newsChannel";
message = "Mary Kom won the bronze medal in Olympics";
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();
Coming Soon 
    Coming Soon 

Send Push Message To All

Send push message to all your users.

Required Parameters

message - Push message in string format.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
	  String message  = "Message which you have to send";
	  PushNotification pushNotification = pushNotificationService.sendPushMessageToAll(message);   
	  System.out.println("message is " +  pushNotification.getMessage());	
	  String jsonResponse = pushNotification.toString();   
    public class Callback : App42Callback  
    {  
	    String message  = "Message which you have to send";
		 pushNotificationService.SendPushMessageToAll(message,this);   
		 void App42Callback.OnException(App42Exception exception)  
		  {  
			Console.WriteLine("Exception Message");  
		  }  
		  void App42Callback.OnSuccess(Object response)  
		  {  
			 PushNotification pushNotification = (PushNotification) response;     
			 String jsonResponse = pushNotification.ToString();  
		  }  
    }  
NSString *message  = @"Message which you have to send";
PushNotification pushNotification = [pushNotificationService sendPushMessageToAll:message];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
String message  = "Message which you have to send";
PushNotification pushNotification = pushNotificationService.sendPushMessageToAll(message);   
System.out.println("message is " +  pushNotification.getMessage());	
String jsonResponse = pushNotification.toString();   
String message  = "Message which you have to send";
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);
	}
}
`
Not Available
String message  = "Message which you have to send";
PushNotification pushNotification = pushNotificationService.SendPushMessageToAll(message);   
Console.WriteLine("message is " +  pushNotification.GetMessage());	
String jsonResponse = pushNotification.ToString();   
$message  = "Message which you have to send";
$pushNotification = $pushNotificationService->sendPushMessageToAll($message);    
print_r("message is " .  $pushNotification->getMessage());	
$jsonResponse = $pushNotification->toString();  
Not Available
message = "vijay kumar shoots the silver medal";
push_notification = push_notification_service.send_push_message_to_all(message);
puts "Message is #{push_notification.message}";
json_response = push_notification.to_s();
Coming Soon 
    Coming Soon 

Send Push Message To All By Type

Send push message to all your users.

Required Parameters

message - Push message in string format. deviceType - type of the device like Android, iOS , WP7.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
Not Available
Not Available
Not Available
Not Available
String message  = "Message which you have to send";
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";
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);
	}
}
`
Not Available
String message  = "Message which you have to send";
PushNotification pushNotification = pushNotificationService.SendPushMessageToAllByType(message,DeviceType.ANDROID);   
Console.WriteLine("message is " +  pushNotification.GetMessage());	
String jsonResponse = pushNotification.ToString();   
$message  = "Message which you have to send";
$pushNotification = $pushNotificationService->sendPushMessageToAllByType($message,DeviceType::ANDROID);    
print_r("message is " .  $pushNotification->getMessage());	
$jsonResponse = $pushNotification->toString();  
Not Available
message = "vijay kumar shoots the silver medal";
dtype = App42::AppTab::DeviceType.new();
push_notification = push_notification_service.send_push_message_to_all_by_type(message, dtype.enum("WP7"));
puts "Message is #{push_notification.message}";
puts "Type is #{push_notification.type}";
json_response = push_notification.to_s();
Coming Soon 
    Coming Soon 

Send Push Message To Channel With json

Send Push Message to particular channel containing Json.

Required Parameters

channel - channel name which you want to send the message. message - Push message in json.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String channelName = "newsChannel";
HashMap< String,String> message = new HashMap< String,String>();
message.put("New Channel", "Message which you have to send");
PushNotification pushNotification = pushNotificationService.sendPushMessageToChannel(channelName, message);
System.out.println("message is " +  pushNotification.getMessage());	
String jsonResponse = pushNotification.toString();   
Not Available 
NSString *message  = @"Message which you have to send";
NSDictionary *messageDictionary = [[NSDictionary alloc]init];
[messageDictionary setObject:@"Message which you have to send" forKey:@"New Channel"]; 
PushNotification *pushNotification = [pushNotificationService sendPushMessageToChannel:channelName withMessageDictionary:messageDictionary];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
Not Available
Not Available
`
Not Available
Not Available
Not Available
Not Available
 Not Available
Coming Soon 
Coming Soon 

Send Push Message To User

Send Push Message to particular channel containing Json.

Required Parameters

userName - User which has app on their device. message - Push message in json.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
	  String userName = "Nick";
	  String message = "Message which you have to send";
	  PushNotification pushNotification = pushNotificationService.sendPushMessageToUser(userName,message);   
	  System.out.println("userName is " + pushNotification.getUserName());
	  System.out.println("message is " + pushNotification.getMessage());
	  String jsonResponse = pushNotification.toString();   
    public class Callback : App42Callback  
    {  
		String userName = "Nick";
	    String message = "Message which you have to send";
	    pushNotificationService.SendPushMessageToUser(userName,message,this);   
		 void App42Callback.OnException(App42Exception exception)  
		  {  
			Console.WriteLine("Exception Message");  
		  }  
		  void App42Callback.OnSuccess(Object response)  
		  {  
			 PushNotification pushNotification = (PushNotification) response;     
			 String jsonResponse = pushNotification.ToString();  
		  }  
    }  
NSString *userName  = @"Nick";
NSString *message  = @"Message which you have to send";
PushNotification *pushNotification = [pushNotificationService sendPushMessageToUser:userName withMessageDictionary:messageDictionary];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
String userName = "Nick";
String message = "Message which you have to send";
PushNotification pushNotification = pushNotificationService.sendPushMessageToUser(userName,message);   
System.out.println("userName is " + pushNotification.getUserName());
System.out.println("message is " + pushNotification.getMessage());
String jsonResponse = pushNotification.toString();   
String userName = "Nick";
String message = "Message which you have to send";
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);
	}
}
`
Not Available
String userName = "Nick";
String message = "Message which you have to send";
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";
$pushNotification = $pushNotificationService->sendPushMessageToUser($userName,$message); 
print_r("userName is " . $pushNotification->getUserName());
print_r("message is " . $pushNotification->getMessage());
$jsonResponse = $pushNotification->toString();   
Not Available
user_name = "Nick";
message = "Hi Nick! you have won 10 points";					
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();
Coming Soon 
Coming Soon 

Send Push Message To User With json

Send Push Message to particular channel containing Json.

Required Parameters

userName - User which has app on their device. message - Push message in json.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
HashMap< String,String> message = new HashMap< String,String>();
message.put("New Channel", "Message which you have to send");
PushNotification pushNotification = pushNotificationService.sendPushMessageToUser(userName, message);
System.out.println("message is " +  pushNotification.getMessage());	
String jsonResponse = pushNotification.toString();   
Not Available 
NSString *userName  = @"Nick";
NSDictionary *messageDictionary = [[NSDictionary alloc]init];
[messageDictionary setObject:@"Message which you have to send" forKey:@"New Channel"]; 
PushNotification *pushNotification = [pushNotificationService sendPushMessageToUser:userName withMessageDictionary:messageDictionary];
NSString *jsonResponse = [pushNotification toString]; 
Not Available
Not Available
Not Available
`
Not Available
Not Available
Not Available
Not Available
Not Available
Coming Soon 
Coming Soon 

Subscribe To Channel

Subscribe to the channel

Required Parameters

userName - username which want to subscribe. channelName - channel name which you want to create. deviceToken - device id for android phones. deviceType - type of the device like Android, iOS , WP7.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
 
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token";
PushNotification pushNotification = pushNotificationService.subscribeToChannel(userName, channel, deviceToken, DeviceType.ANDROID);
System.out.println(pushNotification.getUserName());
String jsonResponse = pushNotification.toString();                
 
public class Callback : App42Callback  
{  
	 String channel = "News Channel";
	 String userName = "Nick";
	 String deviceToken = "Device Token";
	 pushNotificationService.SubscribeToChannel(userName, channel, deviceToken,this);   
	 void App42Callback.OnException(App42Exception exception)  
	  {  
		Console.WriteLine("Exception Message");  
	  }  
	  void App42Callback.OnSuccess(Object response)  
	  {  
		 PushNotification pushNotification = (PushNotification) response;     
		 String jsonResponse = pushNotification.ToString();  
	  }  
}   
Coming Soon	                                     
Not Available         
 
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token"
PushNotification pushNotification = pushNotificationService.subscribeToChannel(userName, channel, deviceToken, DeviceType.iOS);
System.out.println(pushNotification.getUserName());
String jsonResponse = pushNotification.toString();               
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token";
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);
	}
}
`
Not Available
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token";
PushNotification pushNotification = pushNotificationService.SubscribeToChannel(userName, channel, deviceToken, DeviceType.iOS);
System.out.println(pushNotification.GetUserName());
String jsonResponse = pushNotification.ToString();                  
Not Available
Not Available
Coming Soon
Coming Soon 
Coming Soon

Unsubscribe Device To Channel

Selected User Will Be Unsubscribe From The Existing Channel.

Required Parameters

userName - username which want to subscribe. channelName - channel name which you want to create. deviceToken - device id for android phones.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
 
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token";
PushNotification pushNotification = pushNotificationService.unsubscribeDeviceToChannel(userName, channel, deviceToken);
System.out.println(pushNotification.getUserName());
String jsonResponse = pushNotification.toString();                 
public class Callback : App42Callback  
  {  
	 String channel = "News Channel";
	 String userName = "Nick";
	 String deviceToken = "Device Token";
	 pushNotificationService.UnsubscribeDeviceToChannel(userName, channel, deviceToken,this);   
	 void App42Callback.OnException(App42Exception exception)  
	  {  
		Console.WriteLine("Exception Message");  
	  }  
	  void App42Callback.OnSuccess(Object response)  
	  {  
		 PushNotification pushNotification = (PushNotification) response;     
		 String jsonResponse = pushNotification.ToString();  
	  }  
  }    
Coming Soon	                                     
Not Available         
 
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token";
PushNotification pushNotification = pushNotificationService.unsubscribeDeviceToChannel(userName, channel, deviceToken);
System.out.println(pushNotification.getUserName());
String jsonResponse = pushNotification.toString();                
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token";
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);
	}
}
`
Not Available
String channel = "News Channel" ;
String userName = "Nick" ;
String deviceToken = "Device Token";
PushNotification pushNotificationObj = pushNotificationService.UnsubscribeDeviceToChannel(userName, channel, deviceToken);
Console.WriteLine(pushNotification.getUserName());
String jsonResponse = pushNotification.ToString();                    
Not Available
Not Available
Coming Soon
Coming Soon 
Coming Soon

Exception Handling

The functions available under Push Notification API can throw some exceptions in abnormal conditions. Example of the same has been given below.

E.g. If App 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.”.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
 
String channelName = "News Channel";
String message = "Message which you have to send";
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(); 	
}                  
public class Callback : App42Callback  
{  
String channelName = "News Channel";
String message = "Message which you have to send";
pushNotificationService.SendPushMessageToChannel(channelName, message, this);  
void App42Callback.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(); 
}  
void App42Callback.OnSuccess(Object response)  
{  
	PushNotification pushNotification = (PushNotification) response;
	String jsonResponse = pushNotification.ToString();  
}  
}  
	
NSString *channelName = @"News Channel";
NSString *message = @"Message which you have to send";
@try
{
	PushNotification *pushNotification = [pushNotificationService sendMessageToChannel:channelName withMessage:message];  
} 
@catch(App42Exception *exception) 
{
	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; 	
}                                           
Not Available          
String channelName = "News Channel";
String message = "Message which you have to send";
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(); 	
}                   
Coming Soon
`
Not Available
String channelName = "News Channel";
String message = "Message which you have to send";
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";
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(); 	
}
Not Available
Coming Soon
Coming Soon 
Coming Soon

Error Codes

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 for user '@userName'. 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 the channel '@channelName'. 1706 - NOT FOUND - No device is registered with the App. 1707 - NOT FOUND - No device is Subscribed to the channel '@channelName'.