Package io.outbound.sdk
Class OutboundService
- java.lang.Object
-
- IntentService
-
- io.outbound.sdk.OutboundService
-
public class OutboundService extends IntentServiceOutboundService handles tasks related to notifications that Outbound sends. OutboundService or a subclass of it should be registered as a service in your AndroidManifest.xml file.<service android:name="io.outbound.sdk.OutboundService" android:label="OutboundService" > <intent-filter> <action android:name="io.outbound.sdk.action.OPEN_NOTIF" /> </intent-filter> </service>If you would like to implement your own tracking for notifications received (or for one of the other actions), you should subclass it and implement on of the public methods.
OutboundService.onOpenNotification(PushNotification)is called after a notification is clicked.
There are 3 instances variables you can override which determine how the SDK handles deeplinking and opening the app when a notification is clicked.
OutboundService.handleDeeplinksdefaults to true and tells the SDK to handle any deeplinks present in the notification. If you override to false then clicking on an notification will NOT open the app. You will need to implement your own logic for handle notifications that have a link. You should do this in theOutboundService.onOpenNotification(PushNotification)method.OutboundService.fallBackToMainActivitydefaults to true. If handleDeeplinks is true and the link does not resolve, the SDK will fall back to opening the main activity. You can turn this behavior off by setting fallBackToMainActivity to false.OutboundService.openMainActivityByDefaultdefaults true. When the notification DOES NOT contain a deeplink, this tells the SDK to open the main activity when the notification is clicked. Again, you can turn this behavior off by setting openMainAcitvityByDefault to false in your subclass of OoutboundService.
In your implementation of
OutboundService.onOpenNotification(PushNotification), you can find out what Outbound did by calling thePushNotification.linkHandledandPushNotification.mainActivityLaunchedmethods on the PushNotification object passed in.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringACTION_OPEN_NOTIFstatic java.lang.StringEXTRA_NOTIFICATIONprotected booleanfallBackToMainActivityprotected booleanhandleDeeplinksprotected booleanopenMainActivityByDefault
-
Constructor Summary
Constructors Constructor and Description OutboundService()OutboundService(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidonCreate()protected voidonHandleIntent(Intent intent)voidonOpenNotification(PushNotification notif)Called after an Outbound notification is clicked and opened.
-
-
-
Field Detail
-
ACTION_OPEN_NOTIF
public static final java.lang.String ACTION_OPEN_NOTIF
- See Also:
- Constant Field Values
-
EXTRA_NOTIFICATION
public static final java.lang.String EXTRA_NOTIFICATION
-
openMainActivityByDefault
protected boolean openMainActivityByDefault
-
handleDeeplinks
protected boolean handleDeeplinks
-
fallBackToMainActivity
protected boolean fallBackToMainActivity
-
-
Method Detail
-
onCreate
public void onCreate()
-
onHandleIntent
protected final void onHandleIntent(Intent intent)
-
onOpenNotification
public void onOpenNotification(PushNotification notif)
Called after an Outbound notification is clicked and opened. If you want to implement your own logic for routing, links and/or what views open when a notification is clicked, this is where you'd do it.- Parameters:
notif-
-
-