API Reference
Detour
Main SDK singleton.
Methods
Detour.initialize(context: Context, config: DetourConfig): Unit
Detour.processLink(intent: Intent): LinkResult
Detour.getDeferredLink(): LinkResult
Detour.resolveShortLink(url: String): ShortLinkResponse?
Behavior notes
initialize(...)must be called before other SDK methods.processLink(...)checks app-link/scheme intent first, then deferred fallback (unlessDEFERRED_ONLY).getDeferredLink()resolves deferred flow only.- deferred resolution is session-guarded; repeated calls can return
NotFirstLaunch.
DetourDelegate
Lifecycle helper for Activity/Fragment style integrations.
Constructor
DetourDelegate(
lifecycleOwner: LifecycleOwner,
config: DetourConfig,
onLinkResult: (LinkResult) -> Unit
)
Methods
fun onCreate(intent: Intent): Unit
fun onNewIntent(intent: Intent): Unit
DetourConfig
SDK configuration object.
Data class
data class DetourConfig(
val apiKey: String,
val appId: String,
val linkProcessingMode: LinkProcessingMode = LinkProcessingMode.ALL,
val storage: DetourStorage? = null
)
Java builder
DetourConfig.Builder(apiKey: String, appId: String)
.linkProcessingMode(LinkProcessingMode)
.storage(DetourStorage)
.build()
LinkResult
Result returned by processLink() and getDeferredLink().
sealed class LinkResult {
data class Success(
val url: String,
val route: String,
val pathname: String,
val type: LinkType,
val params: Map<String, String>
) : LinkResult()
data object NotFirstLaunch : LinkResult()
data object NoLink : LinkResult()
data class Error(val exception: Exception) : LinkResult()
}
LinkProcessingMode
enum class LinkProcessingMode {
ALL,
WEB_ONLY,
DEFERRED_ONLY
}
LinkType
enum class LinkType {
DEFERRED,
VERIFIED,
SCHEME
}
ShortLinkResponse
Returned by resolveShortLink(...).
data class ShortLinkResponse(
val link: String,
val route: String?,
val parameters: String?
)
DetourStorage
Custom storage interface used by SDK persistence.
interface DetourStorage {
suspend fun getItem(key: String): String?
suspend fun setItem(key: String, value: String)
suspend fun removeItem(key: String) { }
}
DetourAnalytics
Analytics helper initialized by Detour.initialize(...).
Methods
DetourAnalytics.logEvent(eventName: DetourEventNames, data: Any? = null): Unit
DetourAnalytics.logRetention(eventName: String): Unit
DetourEventNames
| Category | Event Name | String Value |
|---|---|---|
| General | Login | login |
Search | search | |
Share | share | |
SignUp | sign_up | |
TutorialBegin | tutorial_begin | |
TutorialComplete | tutorial_complete | |
ReEngage | re_engage | |
Invite | invite | |
OpenedFromPushNotification | opened_from_push_notification | |
| Sales | AddPaymentInfo | add_payment_info |
AddShippingInfo | add_shipping_info | |
AddToCart | add_to_cart | |
RemoveFromCart | remove_from_cart | |
Refund | refund | |
ViewItem | view_item | |
BeginCheckout | begin_checkout | |
Purchase | purchase | |
AdImpression | ad_impression |