Package 

Class PushNotificationsInternal

    • Constructor Detail

      • PushNotificationsInternal

        PushNotificationsInternal()
    • Method Detail

      • subscribeTo

         void subscribeTo(@NonNull() Collection<PushNotificationEvent> events)

        Allows to configure the push notifications that the SDK will subscribe to.

        If the notifications aren't configured, by default the SDK subscribes to the following push notifications:

        • START
        • MESSAGE
        • TRANSFER

        Ensure that you call this method as early as possible, preferably in the implementation ofthe android.app.Application, and definitely before starting an engagement.Calling this method after creating an engagement will only enable push notificationsfor subsequent engagements.

        Parameters:
        events - - Collection of PushNotificationEvent to subscribe to
      • subscribeTo

         void subscribeTo(@NonNull() Context context, @NonNull() Collection<PushNotificationType> types)

        Allows to configure the push notifications that the SDK will subscribe to.

        The same as the subscribeTo but allows to set the push notifications type with default messages:

        • glia_webhook_event_start
        • glia_webhook_event_end
        • glia_webhook_event_failed
        • glia_webhook_event_message
        • glia_webhook_event_transfer
        Parameters:
        context - - Application context* @param types - Collection of PushNotificationType to subscribe to
      • updateFcmToken

         void updateFcmToken(@Nullable() String newFcmToken)

        This method should be called when a new token is generated by Firebase Cloud Messaging framework.

        You should use this method only if you have your own FCM service.

        Parameters:
        newFcmToken - - New FCM token
      • onNewMessage

         void onNewMessage(@NonNull() RemoteMessage message)

        Should be called when a new remote message is received from the Firebase Cloud Messaging framework.

        You should use this method only if you have your own FCM service.

        Parameters:
        message - - New FCM message
      • handleOnMainActivityCreate

        @Nullable() GliaPushMessage handleOnMainActivityCreate(@Nullable() Bundle bundle)

        Should be called when the main application activity is created.

        Usage example:

         protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... GliaPushMessage push = Glia.getPushNotifications() .handleOnMainActivityCreate(getIntent().getExtras()); if (push != null && push.getType() == GliaPushMessage.PushType.CHAT_MESSAGE) { // handle the opening of the push notification } } 
        
        Parameters:
        bundle - - A mapping from String keys got from the main activity intent
      • on

         <T> void on(@NonNull() PushNotifications.PushNotificationsEvent<T> event, @NonNull() Consumer<T> listener)

        This method allows registration of event listeners for PushNotificationHandler.

        If a listener is added while the PushNotificationHandler is processing an event,it is not triggered with the current event.

        If multiple identical listeners are registered on the same event typethe duplicate instances are discarded. They do not cause the listenerto be called twice and do not need to be removed with the removeEventListenermethod.

        Parameters:
        event - - One of PushNotifications.Events
        listener - - Event listener to register
      • off

         <T> void off(@NonNull() PushNotifications.PushNotificationsEvent<T> event, @NonNull() Consumer<T> listener)

        This method allows the removal of event listeners from the PushNotificationHandler.

        If an event listener is removed while the PushNotificationHandler is processing an event,it is not triggered with the current event.

        Calling {@code off} with arguments which do not identify any currently registeredlistener has no effect.

        Parameters:
        event - - One of PushNotifications.Events
        listener - - Event listener to remove