com.netmera.mobile
Class NetmeraPushService

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

public class NetmeraPushService
extends java.lang.Object

This is the main class to manage push notifications in Netmera. With the help of this class, you can register/unregister devices into different groups to get notification.


Constructor Summary
NetmeraPushService()
           
 
Method Summary
static void disablePushInbox()
           
static void enablePushInbox()
           
static NetmeraDeviceDetail getDeviceDetail(android.content.Context context)
          Retrieves the detailed information of a registered device.
static java.util.List<java.lang.String> getDeviceGroups()
          Retrieves the all groups of all registered devices.
static java.lang.String getPushMessage()
          Retrieves the latest arrived push notification message
static java.lang.String getRegistrationId(android.content.Context context)
          Retrieves the registration id of the registered device.It returns empty string if not registered.
static boolean handlePush(android.app.Activity activity)
          Deprecated. use handleRichPush(Activity) instead this. If the coming push notification is rich, the method creates a web view and loads the content of the notification. If the notification is standard, it does nothing.
static boolean handleRichPush(android.app.Activity pushActivity)
          If the coming push notification is rich, the method creates a web view and loads the content of the notification.
static void handleRichPushWithId(android.webkit.WebView richPushWebView, java.lang.String messageId)
          Loads rich push content to the given Webview
static boolean isRegistered(android.content.Context context)
          Checks whether device is registered or not.
static boolean isRichPush()
          Gets the boolean value according to push notification type
static void register(android.content.Context context, java.lang.Class<? extends android.app.Activity> activityClass, java.lang.String senderId)
          Deprecated. use register(Context, String, Class) instead this. Registers device.
static void register(android.content.Context context, java.lang.String senderId, java.lang.Class<? extends NetmeraActivity> pushActivityClass)
          Registers device.
static void register(NetmeraDeviceDetail deviceDetail)
          Registers device to specified groups, if NetmeraDeviceDetail groups are set; otherwise registers to broadcast group
 void sendNotification(java.util.List<BasePush> pushNotifications)
          Sends notification to IOS and Android devices.
static void unregister(android.content.Context context)
          Unregisters device.
static void unregister(android.content.Context context, java.lang.String registerId)
          Unregisters device.
static void unregister(NetmeraDeviceDetail pushDeviceDetail)
          Unregisters device from groups, if NetmeraDeviceDetail groups are set; otherwise unregisters device completely
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetmeraPushService

public NetmeraPushService()
Method Detail

register

@Deprecated
public static void register(android.content.Context context,
                                       java.lang.Class<? extends android.app.Activity> activityClass,
                                       java.lang.String senderId)
                     throws NetmeraException
Deprecated. use register(Context, String, Class) instead this. Registers device.

Parameters:
context - application's context
activityClass - opening activityClass when the push notification is send
senderId - sender id
Throws:
NetmeraException

register

public static void register(android.content.Context context,
                            java.lang.String senderId,
                            java.lang.Class<? extends NetmeraActivity> pushActivityClass)
                     throws NetmeraException
Registers device.

Parameters:
context - application's context
senderId - sender id
pushActivityClass - opening activityClass when the push notification is send. This activity must extend NetmeraActivity class instead Activity.
Throws:
NetmeraException

register

public static void register(NetmeraDeviceDetail deviceDetail)
                     throws NetmeraException
Registers device to specified groups, if NetmeraDeviceDetail groups are set; otherwise registers to broadcast group

Parameters:
deviceDetail - NetmeraDeviceDetail object
Throws:
NetmeraException

isRegistered

public static boolean isRegistered(android.content.Context context)
Checks whether device is registered or not.

Parameters:
context - application's context
Returns:
true if registered, false otherwise

getRegistrationId

public static java.lang.String getRegistrationId(android.content.Context context)
Retrieves the registration id of the registered device.It returns empty string if not registered.

Parameters:
context - application's context
Returns:
registration id

getDeviceGroups

public static java.util.List<java.lang.String> getDeviceGroups()
                                                        throws NetmeraException
Retrieves the all groups of all registered devices.

Returns:
deviceGroups
Throws:
NetmeraException

getDeviceDetail

public static NetmeraDeviceDetail getDeviceDetail(android.content.Context context)
                                           throws NetmeraException
Retrieves the detailed information of a registered device.

Parameters:
context - application's context
Returns:
pushDeviceDetail NetmeraDeviceDetail object
Throws:
NetmeraException

unregister

public static void unregister(android.content.Context context,
                              java.lang.String registerId)
Unregisters device.

Parameters:
context - application's context
registerId - registration id

unregister

public static void unregister(android.content.Context context)
Unregisters device.

Parameters:
context - application's context

unregister

public static void unregister(NetmeraDeviceDetail pushDeviceDetail)
Unregisters device from groups, if NetmeraDeviceDetail groups are set; otherwise unregisters device completely

Parameters:
pushDeviceDetail - NetmeraDeviceDetail object

sendNotification

public void sendNotification(java.util.List<BasePush> pushNotifications)
                      throws NetmeraException
Sends notification to IOS and Android devices.

Throws:
NetmeraException

handleRichPushWithId

public static void handleRichPushWithId(android.webkit.WebView richPushWebView,
                                        java.lang.String messageId)
                                 throws NetmeraException
Loads rich push content to the given Webview

Parameters:
richPushWebView - WebView of registered activity class to the push notification
messageId - Id of the rich push content obtained from the basic push notification
Throws:
NetmeraException - Throws exception if it cannot access server

isRichPush

public static boolean isRichPush()
Gets the boolean value according to push notification type

Returns:
Returns true if the type of the push notification is rich, false otherwise

getPushMessage

public static java.lang.String getPushMessage()
Retrieves the latest arrived push notification message

Returns:
pushMessage Message of the latest push notification

handleRichPush

public static boolean handleRichPush(android.app.Activity pushActivity)
                              throws NetmeraException
If the coming push notification is rich, the method creates a web view and loads the content of the notification. If the notification is standard, it does nothing.

Parameters:
pushActivity - Activity class which was used while registering the device
Returns:
returns false if the notification is a basic one, true otherwise
Throws:
NetmeraException - Throws exception if it cannot access server

handlePush

@Deprecated
public static boolean handlePush(android.app.Activity activity)
                          throws NetmeraException
Deprecated. use handleRichPush(Activity) instead this. If the coming push notification is rich, the method creates a web view and loads the content of the notification. If the notification is standard, it does nothing.

Parameters:
pushActivity - Activity class which was used while registering the device
Returns:
returns false if the notification is a basic one, true otherwise
Throws:
NetmeraException - Throws exception if it cannot access server

enablePushInbox

public static void enablePushInbox()
                            throws NetmeraException
Throws:
NetmeraException

disablePushInbox

public static void disablePushInbox()
                             throws NetmeraException
Throws:
NetmeraException