Skip to main content

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 (unless DEFERRED_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

CategoryEvent NameString Value
GeneralLoginlogin
Searchsearch
Shareshare
SignUpsign_up
TutorialBegintutorial_begin
TutorialCompletetutorial_complete
ReEngagere_engage
Inviteinvite
OpenedFromPushNotificationopened_from_push_notification
SalesAddPaymentInfoadd_payment_info
AddShippingInfoadd_shipping_info
AddToCartadd_to_cart
RemoveFromCartremove_from_cart
Refundrefund
ViewItemview_item
BeginCheckoutbegin_checkout
Purchasepurchase
AdImpressionad_impression