com.netmera.mobile
Class NetmeraPushSender

java.lang.Object
  extended by com.netmera.mobile.NetmeraPushSender

public class NetmeraPushSender
extends java.lang.Object

This class will help you when you want to send push notifications. After creating a NetmeraPushObject, you can use this class to send the notification.


Constructor Summary
NetmeraPushSender()
           
 
Method Summary
static void addTag(java.lang.String tag)
          Add a tag to push notification.
 java.util.List<java.lang.String> getTags()
          Get tags of incoming push notification.
static void sendPushNotification(NetmeraPushObject push)
          Sends given push notification message to specified users.
static void sendPushNotificationInBackground(NetmeraPushObject push)
          Sends given push notification message to specified users in background.
static void sendPushNotificationInBackground(NetmeraPushObject push, NetmeraCallback<java.lang.Void> callback)
          Sends given push notification message to specified users in background.
static void setBoxPush(NetmeraGeoLocation firstPoint, NetmeraGeoLocation secondPoint)
          Creates box using the given two location (latitude,longitude) data in order to send push notifications to devices registered inside that box.
static void setCirclePush(NetmeraGeoLocation startLocation, double distance)
          Creates a circle by taking given location as a base and the distance as the radius in order to send push notifications to devices registered inside that circle.
static void setSendToAndroid(boolean sendToAndroid)
          If you want to send the push notification to Android devices, set it using this method.
static void setSendToIOS(boolean sendToIOS)
          If you want to send the push notification to iOS devices, set it using this method.
static void setTags(java.util.List<java.lang.String> tags)
          Set tag list when sending push notification.
static void whereCustomFieldEqual(java.lang.String key, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetmeraPushSender

public NetmeraPushSender()
Method Detail

setCirclePush

public static void setCirclePush(NetmeraGeoLocation startLocation,
                                 double distance)
Creates a circle by taking given location as a base and the distance as the radius in order to send push notifications to devices registered inside that circle.

Parameters:
startLocation - base location to search near it.
distance - is used to create circle by taking the startLocation as a center.

setBoxPush

public static void setBoxPush(NetmeraGeoLocation firstPoint,
                              NetmeraGeoLocation secondPoint)
Creates box using the given two location (latitude,longitude) data in order to send push notifications to devices registered inside that box.

Parameters:
firstPoint - NetmeraGeoLocation object
secondPoint - NetmeraGeoLocation object

whereCustomFieldEqual

public static void whereCustomFieldEqual(java.lang.String key,
                                         java.lang.Object value)

setSendToAndroid

public static void setSendToAndroid(boolean sendToAndroid)
If you want to send the push notification to Android devices, set it using this method.

Parameters:
sendToAndroid - set true if you want to send, else false

setSendToIOS

public static void setSendToIOS(boolean sendToIOS)
If you want to send the push notification to iOS devices, set it using this method.

Parameters:
sendToIOS - set true if you want to send, else false

setTags

public static void setTags(java.util.List<java.lang.String> tags)
Set tag list when sending push notification. Deletes older added tags.

Parameters:
tags -

addTag

public static void addTag(java.lang.String tag)
Add a tag to push notification.

Parameters:
tag -

getTags

public java.util.List<java.lang.String> getTags()
Get tags of incoming push notification.

Returns:
tagList

sendPushNotificationInBackground

public static void sendPushNotificationInBackground(NetmeraPushObject push,
                                                    NetmeraCallback<java.lang.Void> callback)
Sends given push notification message to specified users in background.

Parameters:
push - notification to send
callback - - NetmeraCallback.onFail(NetmeraException) or NetmeraCallback.onSuccess(Object) methods called when send operation finishes. Falls onFail method if the given push notification is null, if the message in the notification is null, if there is no channel defined or there is a problem with internet connection.

sendPushNotificationInBackground

public static void sendPushNotificationInBackground(NetmeraPushObject push)
Sends given push notification message to specified users in background.

Parameters:
push - notification to send

sendPushNotification

public static void sendPushNotification(NetmeraPushObject push)
                                 throws NetmeraException
Sends given push notification message to specified users.

Parameters:
push - notification to send
Throws:
NetmeraException - if the given push notification is null, if the message in the notification is null, if there is no channel defined or there is a problem with internet connection.