Package com.leanplum

Class LeanplumPushService


  • public class LeanplumPushService
    extends java.lang.Object
    Leanplum push notification service class, handling initialization, opening, showing, integration verification and registration for push notifications.
    • 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 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.
      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.
      static void setCustomizer​(LeanplumPushNotificationCustomizer customizer)
      Sets an object used to customize the appearance of notifications.
      static void setCustomizer​(LeanplumPushNotificationCustomizer customizer, boolean useNotificationBuilderCustomizer)
      Sets an object used to customize the appearance of notifications.
      static void setDefaultCallbackClass​(java.lang.Class<? extends android.app.Activity> callbackClass)
      Changes the default activity to launch if the user opens a push notification.
      static void unregister()
      Unregisters the device from all FCM push notifications.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LeanplumPushService

        public LeanplumPushService()
    • 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 contain LEANPLUM_ACTION_PARAM, LEANPLUM_MESSAGE_PARAM and LEANPLUM_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.