Class OutboundService



  • public class OutboundService
    extends IntentService
    OutboundService 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.

    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.handleDeeplinks defaults 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 the OutboundService.onOpenNotification(PushNotification) method.
    • OutboundService.fallBackToMainActivity defaults 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.openMainActivityByDefault defaults 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 the PushNotification.linkHandled and PushNotification.mainActivityLaunched methods on the PushNotification object passed in.

    • 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
    • Constructor Detail

      • OutboundService

        public OutboundService()
      • OutboundService

        public OutboundService(java.lang.String name)
    • 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 -