Package com.zendesk.connect
Class ConnectActionService
- java.lang.Object
-
- IntentService
-
- com.zendesk.connect.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
istrue
by default. If set to false, then the SDK will ignore any deep links included in the notification payload. -
ConnectActionService.openLaunchActivity
istrue
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(SystemPushPayload)
to handle routing of notifications themselves. Data from the notification payload will be available, including any deep link URLs that may have been ignored. -
-
-
Constructor Summary
Constructors Constructor and Description ConnectActionService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description protected void
onHandleIntent(Intent intent)
void
onOpenNotification(SystemPushPayload 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.
-
-
-
Method Detail
-
onHandleIntent
protected final void onHandleIntent(Intent intent)
-
onOpenNotification
public void onOpenNotification(SystemPushPayload 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 ofSystemPushPayload
-
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 istrue
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 istrue
by default.- Parameters:
shouldHandleDeepLinks
- true if deep links should be handled, false otherwise.
-
-