Android Sample: OctetSample
A Jetpack Compose demo of the public SDK surface, built around two tabs: Generate (produce a proof) and Verify (check one on-device with Octet.verify). It lives under octet-sdk/samples-public/android-sample. Its proof format is byte-compatible with the iOS build.
What it does
Generate. Pick a region, then watch the proof pipeline run step by step (SDK initialized → sensors warmed up → location fixed → proof generated), with per-step timings and a map of your position. You get back the predicate answer from sdk.loc.isWithin(...), and a result card showing the outcome, a confidence bucket, and the battery the run consumed. Generated proofs are kept in a sample-owned store.
Verify. Run Octet.verify(...) on any stored or imported proof and read the grouped on-device checks (signature, freshness, hardware attestation, and the rest), each with a one-line note on any check that could not run and how to make it run. Pick a region to check the proof's claim against, and see the granularity the proof reveals (nothing finer than its level). Proofs export and import as .octetproof files through the Android share and Storage-Access layer.
The Compose UI is driven by a single SampleViewModel that owns the SDK lifecycle, the generate pipeline, verify, region selection, and the map location.
Setup
The SDK activates by attesting the app instance. There is no license key to paste. On a real device it uses hardware key attestation and bootstraps its license on first launch. Copy the local config so the sample builds:
cd samples-public/android-sample
cp local.properties.example local.properties
local.properties is gitignored. You can optionally set octet.playIntegrityCloudProjectNumber (your own Google Cloud project number) to bind the per-proof Play Integrity verdict to that project. It is not required to activate: the bootstrap uses hardware key attestation.
Register the sample's package (com.octetproof.sample, or your own) under your Octet account, as described in Prerequisites, so its attestation resolves to a registered app.
Build
A standalone Gradle project; the SDK (com.octetproof:sdk) resolves from the Octet Maven repository configured in settings.gradle.kts:
./gradlew :app:assembleDebug # build
./gradlew :app:installDebug # build + install on a connected device
The APK lands at app/build/outputs/apk/debug/app-debug.apk. Package: com.octetproof.sample.
Run on a real device
This sample needs a physical device with a hardware-backed keystore. An emulator has no real GNSS, cellular, Wi-Fi, or motion hardware, and cannot attest the device, so it cannot generate proofs.
Requirements
- Android 11 (API 30)+ on the device
- A hardware-backed keystore (TEE or StrongBox)
- Your package registered under your Octet account
See also
- Android Quick Start. Integrating the SDK from scratch.
- On-device Verification. What the Verify tab runs.
- Troubleshooting FAQ. What to do when verdicts don't look right.