Android API Reference
The complete Kotlin API reference for the WarpLink Android SDK: initialization, deep link handling, and attribution methods.
WarpLink
The main entry point. Singleton object.
object WarpLink
Properties
| Property | Type | Description |
|---|---|---|
SDK_VERSION | String | The current SDK version ("1.4.1"). |
isConfigured | Boolean | Whether configure() has been called. Thread-safe. |
attributionResult | WarpLinkDeepLink? | The cached result of the last deferred deep link check, or null if none. |
deferredCheckStatus | DeferredCheckStatus | Where the deferred check stands, read without sending a request. It tells a skipped check from no match. From Java, call WarpLink.INSTANCE.getDeferredCheckStatus(). See DeferredCheckStatus. |
lastTetherTestReceipt | String? | The receipt of the last Tether test code the server took, kept in memory only. clearAttribution() and a restart clear it. |
configure(context, apiKey, options)
fun configure(
context: Context,
apiKey: String,
options: WarpLinkOptions = WarpLinkOptions()
)
Initialize the SDK. Must be called before any other SDK methods.
| Parameter | Type | Description |
|---|---|---|
context | Context | Android context (typically Application). Retains applicationContext. |
apiKey | String | Your WarpLink SDK key (wl_live_ for release builds or wl_test_ for debug builds, then 32 alphanumeric chars). Create it in the dashboard under Keys > SDK keys. An API key is rejected by install attribution. |
options | WarpLinkOptions | Configuration overrides, including the onLink callback and opt-out flags. |
Does not throw. A malformed key is not thrown: configure() logs a warning, dispatches WarpLinkError.InvalidApiKeyFormat to options.onLink (if set), and leaves the SDK unconfigured. This makes it safe to call from Application.onCreate().
The deferred deep link check fires on first launch whenever automaticDeferredDeepLinks is true (the default), with or without onLink set: the SDK still calls the attribution API and records the install. options.onLink only gates delivery of the result and cold-start handling. When options.onLink is set, configure() also auto-registers ActivityLifecycleCallbacks for cold-start handling, and the deferred check's result is dispatched to it. The single callback receives every resolved link (a tap or a deferred install match). Set automaticDeepLinks or automaticDeferredDeepLinks to false to disable either piece.
Call it once at startup. A second call with the same key and the same options does nothing, and the running check keeps running. onLink is not part of that comparison: a new onLink replaces the old one and receives the results. Adding an onLink where there was none, or removing it, rebuilds the SDK. A different key or different options rebuild the SDK, and abandon a check still in flight.
onNewIntent(intent)
fun onNewIntent(intent: Intent)
Forward a warm-start intent to the SDK from your Activity's onNewIntent. The SDK resolves the link and dispatches to onLink. Required because Android delivers warm-start links through onNewIntent. Set android:launchMode="singleTask" on the Activity. A no-op when automaticDeepLinks is false.
isWarpLinkUri(uri)
fun isWarpLinkUri(uri: Uri): Boolean
Check whether a URI is a WarpLink link, without resolving it. Useful when a host has its own router and needs to decide whether to hand a URI to WarpLink at all, since handleDeepLink resolves it as a side effect (claiming the tap, deduping, calling the API).
| Parameter | Type | Description |
|---|---|---|
uri | Uri | The URI to check. |
Before configure(), the known domain set is aplnk.to alone. A link on a custom domain reads as false until it is declared via linkDomains, the app.warplink.DOMAINS manifest meta-data, or /sdk/validate has returned it.
handleDeepLink(uri, callback)
fun handleDeepLink(
uri: Uri,
callback: (Result<WarpLinkDeepLink>) -> Unit
)
Resolve an incoming App Link URI to a deep link.
| Parameter | Type | Description |
|---|---|---|
uri | Uri | The App Link URI from intent?.data. |
callback | (Result<WarpLinkDeepLink>) -> Unit | Called on the main thread. |
Errors: NotConfigured, InvalidUrl, LinkNotFound, PasswordRequired, NetworkError, ServerError, InvalidApiKey, DecodingError
checkDeferredDeepLink(callback)
fun checkDeferredDeepLink(
callback: (Result<WarpLinkDeepLink?>) -> Unit
)
Check for a deferred deep link on first launch. Returns null if no match found. Called automatically by configure() unless automaticDeferredDeepLinks is false.
| Parameter | Type | Description |
|---|---|---|
callback | (Result<WarpLinkDeepLink?>) -> Unit | Called on the main thread. |
On first launch, reads Play Install Referrer then falls back to probabilistic matching (device language + timezone offset, with the IP derived server-side). Subsequent launches return cached result.
"First launch" means the first launch of the current install. A reinstall is a new install and runs the check again, with is_reinstall set on the request. See App Reinstall.
Errors: NotConfigured, NetworkError, ServerError, InvalidApiKey, KeyAppMismatch, DecodingError
redeemInvitation(text, callback)
fun redeemInvitation(
text: String,
callback: (Result<WarpLinkDeepLink?>) -> Unit
)
Redeem a referral invitation the person pasted. This call reads nothing from the clipboard: the text reaches it only through this call.
| Parameter | Type | Description |
|---|---|---|
text | String | The pasted text. |
callback | (Result<WarpLinkDeepLink?>) -> Unit | Called on the main thread. success(link) is a match, also cached as attributionResult. success(null) means the text was not an invitation or matched nothing. |
An invitation that is invalid or expired fails with a message that says how to open the link again. After a network failure the SDK keeps the invitation and tries again on a later launch, a bounded number of times. Skipping this call, or any failure, leaves the app fully usable.
Errors: NotConfigured, NetworkError, ServerError
claimReferral(installerId, callback)
fun claimReferral(
installerId: String,
callback: (Result<ReferralClaimResult>) -> Unit
)
Credit the referral behind this install to the person who just signed up. installerId is your own stable id for them, 1 to 128 characters. The call is safe to repeat: the same id gets the same answer and is never credited twice. A status of NONE is an ordinary answer, not an error.
ReferralClaimResult is in app.warplink. ReferralClaimStatus, MatchMethod, EvidenceClass and ReplayState are in app.warplink.referral.
| Property | Type | Description |
|---|---|---|
status | ReferralClaimStatus | CLAIMED, FLAGGED, IGNORED or NONE. |
referralId | String? | The referral's id. null for NONE. |
linkId, linkUrl | String? | The link the referral came from. |
matchMethod | MatchMethod? | How the referral was matched. |
isExact | Boolean | true when the match rests on exact evidence. |
matchConfidence | Double? | The confidence of an estimated match. |
flags | List<String> | Reasons for review, for example outside_window. |
duplicateOf | String? | For IGNORED, the referral that holds the credit. |
updated | Boolean | true when this call replaced an estimate with an exact match. |
replayState | ReplayState? | ORIGINAL or REPLAYED. |
Errors: NotConfigured, NetworkError, ServerError, InvalidApiKey, KeyAppMismatch. An empty or over-long installerId fails with ServerError and status code 400.
isAttributionComplete()
fun isAttributionComplete(): Boolean
Whether the deferred attribution check has definitively completed for this install. Returns false before configure() runs or before the check completes. The React Native bridge reads this so a deferred match reaches onLink at most once across launches, matching the native auto-dispatch guard.
readTether(callback)
fun readTether(callback: (Result<TetherReadResult>) -> Unit)
The same call the iOS, React Native and Flutter SDKs offer, so one code path serves every platform. Android never reads the clipboard. The callback gets success(TetherReadResult.NoClipboard) once configure() has run, and failure(WarpLinkError.NotConfigured) before. The callback runs on the main thread. A Tether test code reaches Android through the Play Install Referrer, and lastTetherTestReceipt holds its receipt. See Tether.
clearAttribution()
fun clearAttribution(): Result<Unit>
Forgets this install's attribution so you can test a first launch again without deleting the app: the cached match, the attempt and completed markers, and any held referral invitation. Only the device is cleared. Server records are not deleted.
Test only. With a wl_live_ key this does nothing and returns success, so it never erases a live install's attribution. With a wl_test_ key and automaticDeferredDeepLinks on, a check already in flight is discarded and a new check starts. A match from it reaches onLink.
Errors: WarpLinkError.NotConfigured before configure. WarpLinkError.DecodingError with the cause message "Could not clear stored attribution data." when a stored item could not be deleted and some state may remain. Calling again is safe.
WarpLinkOptions
data class WarpLinkOptions(
val apiEndpoint: String = "https://api.warplink.app/v1",
val debugLogging: Boolean = false,
val automaticDeepLinks: Boolean = true,
val automaticDeferredDeepLinks: Boolean = true,
val linkDomains: List<String> = emptyList(),
val onLink: ((Result<WarpLinkDeepLink>) -> Unit)? = null
)
| Property | Type | Default | Description |
|---|---|---|---|
apiEndpoint | String | "https://api.warplink.app/v1" | API endpoint URL. |
debugLogging | Boolean | false | Enable WarpLink Logcat tag logging. |
automaticDeepLinks | Boolean | true | Auto-register cold-start handling and resolve forwarded intents. |
automaticDeferredDeepLinks | Boolean | true | Auto-run the deferred deep link check on first launch. |
linkDomains | List<String> | emptyList() | Extra hosts the SDK should treat as yours, for links served from a custom domain. |
onLink | ((Result<WarpLinkDeepLink>) -> Unit)? | null | Single callback for cold start, warm start, and deferred results. Disambiguate with isDeferred. |
The match window is server-side (set per link in the dashboard), so there is no matchWindowHours option.
linkDomains and the manifest meta-data
linkDomains is additive, never a replacement. The SDK recognizes the union of aplnk.to, linkDomains, the comma separated app.warplink.DOMAINS meta-data in AndroidManifest.xml, and the domains returned by /sdk/validate. The first three are known synchronously at configure(), so a launch intent on a custom domain is claimed on the first launch instead of waiting for the server.
<meta-data
android:name="app.warplink.DOMAINS"
android:value="links.yourapp.com,go.yourapp.com" />
Entries are normalized: trimmed, lowercased, and reduced to a host if a full URL is given. A port is dropped, because Uri.getHost() never carries one. Empty entries are dropped. A www. prefix is preserved, since it is a different host.
DeferredCheckStatus
sealed class DeferredCheckStatus
Where the deferred check stands for this install. Read it with WarpLink.deferredCheckStatus. It sends no request, and it comes from state stored on the device, so a relaunch keeps it.
| Type | Meaning |
|---|---|
NotChecked | No check has finished for this install and none is running. A failed check whose wait has passed also reads NotChecked. |
Checking | A check is running, or waiting for an activity to come on screen. |
Matched | The check finished and found a link. |
NoMatch | The check finished and the server found no link. |
Waiting(retryAtMillis: Long) | An earlier check failed. The SDK sends nothing before retryAtMillis, in epoch milliseconds. |
SkippedOldInstall | The install is older than 30 days by default, so no request is sent. |
Stopped | The SDK gave up 3 days after the first failure by default. No request is sent. |
A wl_test_ key never reports Waiting, SkippedOldInstall or Stopped. With debugLogging on, the SDK prints Deferred check request: attempt <n>, raw signals <yes|no> for each check, and Deferred check: <state> when a check ends, under the WarpLink Logcat tag. A waiting check prints Deferred check: waiting, retry at <ISO 8601 time>. See If your test did not match.
TetherReadMode
Android has no Tether read mode and no tetherReadMode option. The SDK never reads the clipboard, and the install referrer carries the link. The iOS, React Native and Flutter SDKs have the option.
WarpLinkPasteButton
Android has no paste button. Do not add a clipboard permission. See Tether.
TetherReadResult
sealed interface TetherReadResult
TetherReadResult.NoClipboard is the only value on Android. It means the SDK read no clipboard, so there is no code to use.
WarpLinkDeepLink
data class WarpLinkDeepLink(
val linkId: String,
val destination: String,
val deepLinkUrl: String? = null,
val customParams: Map<String, Any> = emptyMap(),
val isDeferred: Boolean = false,
val matchType: MatchType? = null,
val matchConfidence: Double? = null,
val matchGuaranteed: Boolean = false,
val attributionId: String? = null,
val matchMethod: MatchMethod? = null,
val evidenceClass: EvidenceClass? = null,
val replayState: ReplayState? = null,
val capturedParams: Map<String, Any> = emptyMap(),
val tappedAt: String? = null
)
| Property | Type | Description |
|---|---|---|
linkId | String | Unique link identifier. |
destination | String | Resolved destination URL. |
deepLinkUrl | String? | Android-specific deep link URL (e.g., myapp://path). |
customParams | Map<String, Any> | The query parameters of the link's destination URL on a direct open, empty on a deferred match. |
isDeferred | Boolean | Whether resolved via deferred attribution. |
matchType | MatchType? | DETERMINISTIC or PROBABILISTIC. |
matchConfidence | Double? | Confidence score (0.0–1.0). |
matchGuaranteed | Boolean | True only for an exact match. Use it to pick a destination, and keep sign-in on your own authentication. |
attributionId | String? | A stable id for this attribution. Send it to your backend to claim from there. |
matchMethod | MatchMethod? | INSTALL_TOKEN, ANDROID_REFERRER, REFERRER, DEVICE_ID, LINK_OPEN or PROBABILISTIC. REFERRER is a plain link ID from the Play install referrer. null for a value this SDK does not know. |
evidenceClass | EvidenceClass? | EXACT, ESTIMATED or LEGACY_LINK. null is never read as exact. |
replayState | ReplayState? | ORIGINAL for the first answer, REPLAYED for a repeat. |
capturedParams | Map<String, Any> | The allowed parameters captured when the link was tapped. Empty when there are none. |
tappedAt | String? | When the link was tapped, as the server wrote it. |
MatchType
enum class MatchType {
DETERMINISTIC,
PROBABILISTIC
}
| Value | Description |
|---|---|
DETERMINISTIC | Matched via Play Install Referrer. Confidence is always 1.0. |
PROBABILISTIC | Matched via enriched match key. Confidence varies. |
WarpLinkError
sealed class WarpLinkError(
message: String,
cause: Throwable? = null
) : Exception(message, cause)
| Subclass | Description |
|---|---|
NotConfigured | SDK used before configure(). |
InvalidApiKeyFormat | Key format invalid. Reported to onLink by configure(). |
InvalidApiKey | Key rejected by server. |
KeyAppMismatch | The key is valid but tied to a different app. Use the SDK key created for this app. |
NetworkError(cause) | Network request failed. |
ServerError(statusCode, message) | API error response. |
InvalidUrl | Not a recognized WarpLink domain. |
LinkNotFound | Link not found or inactive. |
PasswordRequired | Link is password protected, so it resolves to no destination and no platform URLs. |
DecodingError(cause) | Response parsing failed. clearAttribution() also fails with it, with the cause message "Could not clear stored attribution data.", when a stored item could not be deleted. |
Thread Safety
isConfiguredis thread-safe (protected bysynchronized)- All callbacks are dispatched to the main thread
configure()can be called from any thread. Call it once at startup. A repeat call with the same key and options changes nothing exceptonLink
Android Install Attribution
Understand how the WarpLink Android SDK attributes installs using the Play Install Referrer, probabilistic matching, and privacy controls.
React Native SDK
Integrate the WarpLink React Native SDK for Universal Links on iOS, App Links on Android, deferred deep links, and install attribution.