Package com.leanplum
Class LeanplumPushService
- java.lang.Object
-
- com.leanplum.LeanplumPushService
-
public class LeanplumPushService extends java.lang.ObjectLeanplum push notification service class, handling initialization, opening, showing, integration verification and registration for push notifications.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLEANPLUM_ACTION_PARAMAction param key contained when Notification Bundle is parsed withparseNotificationBundle(Bundle).static java.lang.StringLEANPLUM_MESSAGE_IDMessage id param key contained when Notification Bundle is parsed withparseNotificationBundle(Bundle).static java.lang.StringLEANPLUM_MESSAGE_PARAMMessage title param key contained when Notification Bundle is parsed withparseNotificationBundle(Bundle).static java.lang.StringLEANPLUM_NOTIFICATIONIntent action used when broadcast is received in custom BroadcastReceiver.static java.lang.StringLEANPLUM_SENDER_IDLeanplum's built-in Google Cloud Messaging sender ID.
-
Constructor Summary
Constructors Constructor Description LeanplumPushService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.Object>parseNotificationBundle(android.os.Bundle notificationBundle)Parse notification bundle.static voidpostHandlePushNotification(android.content.Context context, android.content.Intent intent)Must be called after deciding which activity will be opened, to allow Leanplum SDK to track stats, open events etc.static android.os.BundlepreHandlePushNotification(android.content.Context context, android.content.Intent intent)Must be called before deciding which activity will be opened, to allow Leanplum SDK to track stats, open events etc.static voidsetCustomizer(LeanplumPushNotificationCustomizer customizer)Sets an object used to customize the appearance of notifications.static voidsetCustomizer(LeanplumPushNotificationCustomizer customizer, boolean useNotificationBuilderCustomizer)Sets an object used to customize the appearance of notifications.static voidsetDefaultCallbackClass(java.lang.Class<? extends android.app.Activity> callbackClass)Changes the default activity to launch if the user opens a push notification.static voidunregister()Unregisters the device from all FCM push notifications.
-
-
-
Field Detail
-
LEANPLUM_SENDER_ID
public static final java.lang.String LEANPLUM_SENDER_ID
Leanplum's built-in Google Cloud Messaging sender ID.- See Also:
- Constant Field Values
-
LEANPLUM_NOTIFICATION
public static final java.lang.String LEANPLUM_NOTIFICATION
Intent action used when broadcast is received in custom BroadcastReceiver.- See Also:
- Constant Field Values
-
LEANPLUM_ACTION_PARAM
public static final java.lang.String LEANPLUM_ACTION_PARAM
Action param key contained when Notification Bundle is parsed withparseNotificationBundle(Bundle).- See Also:
- Constant Field Values
-
LEANPLUM_MESSAGE_PARAM
public static final java.lang.String LEANPLUM_MESSAGE_PARAM
Message title param key contained when Notification Bundle is parsed withparseNotificationBundle(Bundle).- See Also:
- Constant Field Values
-
LEANPLUM_MESSAGE_ID
public static final java.lang.String LEANPLUM_MESSAGE_ID
Message id param key contained when Notification Bundle is parsed withparseNotificationBundle(Bundle).- See Also:
- Constant Field Values
-
-
Method Detail
-
setDefaultCallbackClass
public static void setDefaultCallbackClass(java.lang.Class<? extends android.app.Activity> callbackClass)
Changes the default activity to launch if the user opens a push notification.- Parameters:
callbackClass- The activity class.
-
setCustomizer
public static void setCustomizer(LeanplumPushNotificationCustomizer customizer)
Sets an object used to customize the appearance of notifications. Call this from your Application class's onCreate method so that the customizer is set when your application starts in the background.- Parameters:
customizer- LeanplumPushNotificationCustomizer push notification customizer.
-
setCustomizer
public static void setCustomizer(LeanplumPushNotificationCustomizer customizer, boolean useNotificationBuilderCustomizer)
Sets an object used to customize the appearance of notifications. Call this from your Application class's onCreate method so that the customizer is set when your application starts in the background.- Parameters:
customizer- LeanplumPushNotificationCustomizer push notification customizer.useNotificationBuilderCustomizer- True if if you want to support 2 lines of text on BigPicture style push notification.
-
parseNotificationBundle
public static java.util.Map<java.lang.String,java.lang.Object> parseNotificationBundle(android.os.Bundle notificationBundle)
Parse notification bundle. Use this method to get parsed bundle to decide next step. Parsed data will containLEANPLUM_ACTION_PARAM,LEANPLUM_MESSAGE_PARAMandLEANPLUM_MESSAGE_ID- Parameters:
notificationBundle- Bundle to be parsed.- Returns:
- Map containing Actions, Message title and Message Id.
-
preHandlePushNotification
public static android.os.Bundle preHandlePushNotification(android.content.Context context, android.content.Intent intent)Must be called before deciding which activity will be opened, to allow Leanplum SDK to track stats, open events etc.- Parameters:
context- Surrounding context.intent- Received Intent.- Returns:
- Bundle containing push notification data.
-
postHandlePushNotification
public static void postHandlePushNotification(android.content.Context context, android.content.Intent intent)Must be called after deciding which activity will be opened, to allow Leanplum SDK to track stats, open events etc.- Parameters:
context- Surrounding context.intent- Received Intent.
-
unregister
public static void unregister()
Unregisters the device from all FCM push notifications. You shouldn't need to call this method in production.
-
-