Class Outbound
- java.lang.Object
-
- io.outbound.sdk.Outbound
-
public class Outbound extends java.lang.Object
Public interface for Outbound.Outbound works with users and events. You tell Outbound about user using the
Outbound.identify(User)
method. Events are sent using theOutbound.track(Event)
method.
-
-
Constructor Summary
Constructors Constructor and Description Outbound()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static void
disable()
Disable the current user's device token.static java.lang.String
getActiveToken()
Get the Active User's Token.static void
identify(User user)
Identify the app user.static void
init(Application app, java.lang.String apiKey)
Initialize the Outbound SDK.static void
init(Application app, java.lang.String apiKey, java.lang.String notificationChannelId)
Initialize the Outbound SDK.static void
logout()
If an anonymous user has been created OR a user was identified, logout will 1) disable their FCM device token with Outbound and 2) clear the user from memory.static boolean
pairDevice(java.lang.String pin)
Called from admin activity to pair the device with an Outbound account.static void
register()
Register the current user's FCM token with Outbound allowing Outbound to send the user push notifications.static void
track(Event event)
Track anEvent
for the current user.
-
-
-
Method Detail
-
init
public static void init(Application app, java.lang.String apiKey)
Initialize the Outbound SDK.- Parameters:
app
- instance of your Androidandroid.app.Application
apiKey
- your Outbound environment's private API key
-
init
public static void init(Application app, java.lang.String apiKey, java.lang.String notificationChannelId)
Initialize the Outbound SDK.- Parameters:
app
- instance of your Androidandroid.app.Application
apiKey
- your Outbound environment's private API keynotificationChannelId
- the notification channel to deliver notifications to
-
getActiveToken
public static java.lang.String getActiveToken()
Get the Active User's Token. If there is no active user, then the value returned will be null.
-
identify
public static void identify(User user)
Identify the app user. UseUser.Builder
to build a user object with all available attributes.Identify should be called whenever your user logs in or any time information about the user changes (for example, when they edit their profile).
- Parameters:
user
- the user to be identified
-
track
public static void track(Event event)
Track anEvent
for the current user. An "event" is any action the user does that you want to track. Obvious events might be "login", "register" or "add item to cart". Page views could also be events that are track.If you have not called
Outbound.identify(User)
, an anonymous user will be created and identified. If/when you are able to identify the user, they will be aliased to the anonymous user automatically.- Parameters:
event
- the event to be tracked
-
register
public static void register()
Register the current user's FCM token with Outbound allowing Outbound to send the user push notifications. As withOutbound.track(Event)
, if the user has not been identified, an anonymous user will be created.Ideally you should never have to manually register a user. The device token is automatically added to all
Outbound.identify(User)
calls and if you track an event before identifying, an anonymous user is created (with a FCM token).
-
disable
public static void disable()
Disable the current user's device token. This will prevent Outbound from sending push notifications to the device until the token is reactivated.Unlike
Outbound.register()
andOutbound.track(Event)
, an anonymous user is NOT created if a user has not been identified. In that case the disable call will simply exit without doing anything.Like
Outbound.register()
you should not need to call disable.Outbound.logout()
is the recommended way of disabling a user's device token.
-
logout
public static void logout()
If an anonymous user has been created OR a user was identified, logout will 1) disable their FCM device token with Outbound and 2) clear the user from memory. The SDK then goes back to an empty state. So if you callOutbound.track(Event)
after calling logout, a new, anonymous user will be created.
-
pairDevice
public static boolean pairDevice(java.lang.String pin)
Called from admin activity to pair the device with an Outbound account.Processed on whatever thread it is called from. DO NOT CALL on main thread.
-
-