Android
Add Vouch to a Kotlin app with Gradle.
Package not yet published
The library lives in the repository under sdks/android and can be included as a Gradle
composite build today. Maven Central coordinates dev.vouch:vouch-android follow.
Install
dependencies {
implementation("dev.vouch:vouch-android:0.1.0")
}Minimum SDK 23. The library has no third-party dependencies beyond the Play Install Referrer client and stays well under 500 KB.
Register signing fingerprints
Add every SHA-256 fingerprint that signs a build you ship: debug, upload, and the Play App Signing
key. The dashboard warns if the Play App Signing fingerprint is missing. Vouch hosts
/.well-known/assetlinks.json for you and checks it hourly.
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android | grep SHA256Add the intent filter
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTask">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="yourapp.vouch.dev" />
</intent-filter>
</activity>Initialise and handle links
Your publishable key and app id are in the dashboard under Settings → API keys and Apps.
class App : Application() {
override fun onCreate() {
super.onCreate()
// Returns in under 50 ms; all I/O runs on Dispatchers.IO.
Vouch.configure(
context = this,
publishableKey = "pk_test_…",
appId = "app_…",
environment = Environment.TEST,
options = VouchOptions(linkHosts = listOf("yourapp.vouch.dev")),
)
Vouch.onLink { link ->
// Exactly once per link, cold or warm start, after setReady().
router.navigate(link.destination, link.params)
}
}
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Vouch.handle(intent) // App Link launch
setUpRouter()
Vouch.setReady() // held links are delivered now
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
Vouch.handle(intent)
}
}Deferred deep links
On the first open after an install the SDK reads the Play Install Referrer, extracts the signed
match token the store redirect carried, and reports the install. A match arrives through
onLink with isDeferred = true and matchType = INSTALL_REFERRER, which is deterministic. Without
a token the server may return PROBABILISTIC when exactly one click fits, and never guesses
between two.
val pending = Vouch.pendingLink() // peek before navigating, without consumingEvents, identity and share links
Vouch.identify("user_123")
Vouch.track("checkout_completed", mapOf("plan" to "pro"))
val link = Vouch.createLink("/invite", params = mapOf("ref" to userId))Events queue offline in the app's private storage and are delivered in order with server-side deduplication.
Referrals and device security
Planned API, not yet shipped
The calls below are the agreed shape of the SDK additions for Referrals and device security. They are not in a released SDK yet. The server endpoints they call are live, so you can drive both modules over HTTP today using the routes in those sections.
// A personal invite link and code for the signed-in user.
val invite = Vouch.referrals.link()
share(invite.url, invite.code)
// Someone typing a code instead of following a link.
Vouch.referrals.redeem("W3ZYEPD8")
// Attestation runs automatically; this is the manual trigger.
val verdict = Vouch.security.attest()Verify
Use the dashboard's verification step with a physical device. From the emulator, point the SDK at a
local server with VouchOptions(apiBaseUrl = "http://10.0.2.2:8787").