Class ConnectActionService



  • public class ConnectActionService
    extends IntentService

    Handles tasks related to notifications sent by Connect. ConnectActionService or a subclass should be registered in the Android manifest of the host app.

    
         <service android:name="com.zendesk.connect.ConnectActionService">
             <intent-filter>
                 <action android:name="{packageName}.connect.action.OPEN_NOTIFICATION"/>
             </intent-filter>
         </service>
     

    The default behaviour of the SDK is to handle deep links if they are present in the notification payload, or to open the host app's launch activity if there is no deep link. The following static fields can be updated to change the behaviour:

    • ConnectActionService.handleDeepLinks is true by default. If set to false, then the SDK will ignore any deep links included in the notification payload.
    • ConnectActionService.openLaunchActivity is true by default. If set to false, then the SDK will not attempt to launch the host app's launch activity as a fallback.
    • If both are updated to false then the SDK will not attempt to launch any intent

    Integrators can extend this class and override ConnectActionService.onOpenNotification(NotificationPayload) to handle routing of notifications themselves. Data from the notification payload will be available, including any deep link URLs that may have been ignored.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected void onHandleIntent(Intent intent) 
      void onOpenNotification(NotificationPayload payload)
      This method will be called after a Connect notification has been opened.
      static void shouldHandleDeepLinks(boolean shouldHandleDeepLinks)
      Modifies the behaviour of the service to open any deep links when a notification is opened if any dependencies in the host app package can handle it.
      static void shouldOpenLaunchActivityByDefault(boolean shouldOpenLaunchActivity)
      Modifies the behaviour of this service to open the host app launch activity when a notification is opened and there is no usable deep link.
      • Methods inherited from class java.lang.Object

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

      • ConnectActionService

        public ConnectActionService()
    • Method Detail

      • onHandleIntent

        protected final void onHandleIntent(Intent intent)
      • onOpenNotification

        public void onOpenNotification(NotificationPayload payload)
        This method will be called after a Connect notification has been opened. Override this method to provide your own logic for routing after a notification has been opened.
        Parameters:
        payload - an instance of NotificationPayload
      • shouldOpenLaunchActivityByDefault

        public static void shouldOpenLaunchActivityByDefault(boolean shouldOpenLaunchActivity)
        Modifies the behaviour of this service to open the host app launch activity when a notification is opened and there is no usable deep link. This is true by default.
        Parameters:
        shouldOpenLaunchActivity - true if the launch activity should be launched as a fallback, false otherwise.
      • shouldHandleDeepLinks

        public static void shouldHandleDeepLinks(boolean shouldHandleDeepLinks)
        Modifies the behaviour of the service to open any deep links when a notification is opened if any dependencies in the host app package can handle it. This is true by default.
        Parameters:
        shouldHandleDeepLinks - true if deep links should be handled, false otherwise.