java.lang.Objectcom.netmera.mobile.NetmeraPushService
public class NetmeraPushService
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 |
---|
public NetmeraPushService()
Method Detail |
---|
@Deprecated public static void register(android.content.Context context, java.lang.Class<? extends android.app.Activity> activityClass, java.lang.String senderId) throws NetmeraException
register(Context, String, Class)
instead this.
Registers device.
context
- application's contextactivityClass
- opening activityClass when the push notification is sendsenderId
- sender id
NetmeraException
public static void register(android.content.Context context, java.lang.String senderId, java.lang.Class<? extends NetmeraActivity> pushActivityClass) throws NetmeraException
context
- application's contextsenderId
- sender idpushActivityClass
- opening activityClass when the push notification is send. This activity must extend NetmeraActivity
class instead Activity
.
NetmeraException
public static void register(NetmeraDeviceDetail deviceDetail) throws NetmeraException
deviceDetail
- NetmeraDeviceDetail object
NetmeraException
public static boolean isRegistered(android.content.Context context)
context
- application's context
public static java.lang.String getRegistrationId(android.content.Context context)
context
- application's context
public static java.util.List<java.lang.String> getDeviceGroups() throws NetmeraException
NetmeraException
public static NetmeraDeviceDetail getDeviceDetail(android.content.Context context) throws NetmeraException
context
- application's context
NetmeraException
public static void unregister(android.content.Context context, java.lang.String registerId)
context
- application's contextregisterId
- registration idpublic static void unregister(android.content.Context context)
context
- application's contextpublic static void unregister(NetmeraDeviceDetail pushDeviceDetail)
pushDeviceDetail
- NetmeraDeviceDetail objectpublic void sendNotification(java.util.List<BasePush> pushNotifications) throws NetmeraException
NetmeraException
public static void handleRichPushWithId(android.webkit.WebView richPushWebView, java.lang.String messageId) throws NetmeraException
richPushWebView
- WebView of registered activity class to the push notificationmessageId
- Id of the rich push content obtained from the basic push
notification
NetmeraException
- Throws exception if it cannot access serverpublic static boolean isRichPush()
public static java.lang.String getPushMessage()
public static boolean handleRichPush(android.app.Activity pushActivity) throws NetmeraException
pushActivity
- Activity class which was used while registering the device
NetmeraException
- Throws exception if it cannot access server@Deprecated public static boolean handlePush(android.app.Activity activity) throws NetmeraException
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.
pushActivity
- Activity class which was used while registering the device
NetmeraException
- Throws exception if it cannot access serverpublic static void enablePushInbox() throws NetmeraException
NetmeraException
public static void disablePushInbox() throws NetmeraException
NetmeraException