com.shephertz.app42.paas.sdk.android.push
Class PushNotificationService

java.lang.Object
  extended by com.shephertz.app42.paas.sdk.android.push.PushNotificationService

public class PushNotificationService
extends java.lang.Object

The service is for pushing the notifications to any device using GCM(Google Cloud Messaging). You have to upload your apikey that you received while registering for GCM and you have to store your device token with particular username. This service allows you the feature of sending message to particular channel, particular user or to all your users.For sending message to any channel, you have to create the channel and send the message to channel. The users which have subscribed to that channel will receive all the notification for that channel. For sending message to particular user, you have to pass username and message. Notification will sent to the device of registered user. The most important feature you can send your message to all your device whether it is iphone, android or blackberry.


Constructor Summary
PushNotificationService(java.lang.String apiKey, java.lang.String secretKey, java.lang.String baseURL)
          This is a constructor that takes
 
Method Summary
 PushNotification createChannelForApp(java.lang.String channel, java.lang.String description)
          Create Channel for app on which user can subscribe and get the notification for that channel
 PushNotification sendPushMessageToAll(java.lang.String message)
          Send push message to all your users
 PushNotification sendPushMessageToChannel(java.lang.String channel, java.util.HashMap<java.lang.String,java.lang.String> message)
          Send Push Message to particular channel containing Json
 PushNotification sendPushMessageToChannel(java.lang.String channel, java.lang.String message)
          send push message to channel containing string
 PushNotification sendPushMessageToUser(java.lang.String username, java.util.HashMap<java.lang.String,java.lang.String> message)
          Send Push Message to particular user
 PushNotification sendPushMessageToUser(java.lang.String username, java.lang.String message)
          Send Push Message To paticular user in string format
 PushNotification storeDeviceToken(java.lang.String Username, java.lang.String deviceToken)
          Stores your device token on server with particular username
 PushNotification subscribeToChannel(java.lang.String channel, java.lang.String userName)
          Subscribe to the channel
 PushNotification unsubscribeFromChannel(java.lang.String channel, java.lang.String userName)
          Unsubscribe from particular channel
 PushNotification uploadApiKey(java.lang.String apiKey)
          Upload api key to server that will be used while sending notifications to the devices.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PushNotificationService

public PushNotificationService(java.lang.String apiKey,
                               java.lang.String secretKey,
                               java.lang.String baseURL)
This is a constructor that takes

Parameters:
apiKey -
secretKey -
baseURL -
Method Detail

createChannelForApp

public PushNotification createChannelForApp(java.lang.String channel,
                                            java.lang.String description)
                                     throws App42Exception
Create Channel for app on which user can subscribe and get the notification for that channel

Parameters:
channel - - channel name which you want to create
description - = description for that channel
Returns:
PushNotification Object
Throws:
App42Exception

sendPushMessageToAll

public PushNotification sendPushMessageToAll(java.lang.String message)
Send push message to all your users

Parameters:
message - push message
Returns:
PushNotification Object

sendPushMessageToChannel

public PushNotification sendPushMessageToChannel(java.lang.String channel,
                                                 java.util.HashMap<java.lang.String,java.lang.String> message)
Send Push Message to particular channel containing Json

Parameters:
channel - channel name which you want to send your json message
message - push message in HashMap format
Returns:
PushNotification Object

sendPushMessageToChannel

public PushNotification sendPushMessageToChannel(java.lang.String channel,
                                                 java.lang.String message)
send push message to channel containing string

Parameters:
channel - channel name which you want to send the message
message - push message in string format
Returns:
PushNotification Object

sendPushMessageToUser

public PushNotification sendPushMessageToUser(java.lang.String username,
                                              java.util.HashMap<java.lang.String,java.lang.String> message)
Send Push Message to particular user

Parameters:
username - username which you want to send message
message - push Message in json
Returns:
PushNotification Object

sendPushMessageToUser

public PushNotification sendPushMessageToUser(java.lang.String username,
                                              java.lang.String message)
Send Push Message To paticular user in string format

Parameters:
username - username which you want to send the message
message - push message
Returns:
PushNotification Object

storeDeviceToken

public PushNotification storeDeviceToken(java.lang.String Username,
                                         java.lang.String deviceToken)
                                  throws App42Exception
Stores your device token on server with particular username

Parameters:
Username - username with which you want your device to be registered
deviceToken - device id for android phones
Returns:
PushNotification Object
Throws:
App42Exception

subscribeToChannel

public PushNotification subscribeToChannel(java.lang.String channel,
                                           java.lang.String userName)
                                    throws App42Exception
Subscribe to the channel

Parameters:
channel - the channel name which you want to subscribe
userName - username which want to subscribe
Returns:
PushNotification Object
Throws:
App42Exception

unsubscribeFromChannel

public PushNotification unsubscribeFromChannel(java.lang.String channel,
                                               java.lang.String userName)
                                        throws App42Exception
Unsubscribe from particular channel

Parameters:
channel - channel name which you want to unsubscribe
userName - username which want to unsubscribe
Returns:
PushNotification Object
Throws:
App42Exception

uploadApiKey

public PushNotification uploadApiKey(java.lang.String apiKey)
                              throws App42Exception
Upload api key to server that will be used while sending notifications to the devices.

Parameters:
apiKey - the apiKey which you have received while registering for GCM.
Returns:
PushNotification Object
Throws:
App42Exception