Android quickstart
Get started

Android quickstart

Sign in an already activated test consumer and read their wallet in an Android app. This first read checks your setup, sign-in and developer proof.

Choose your path

Both paths need the approved inputs below. Sign in and read the wallet before adding other features. Use installation for SDK access and the current release/build status.

The repository starter download contains the new minimal apps from 2dc4eca. They show a wallet ID and do not include activation or payment UI. The original complete starters, including balance display, remain available below at their original 8cf5088 baseline.

Before you start

InputGet it from
SDK repository accessWollette; minimal starter 2dc4eca, original complete starter 8cf5088
Matching test API and hosted-login originsYour Wollette onboarding contact
Registered DeveloperId and matching public materialYour Wollette developer enrolment
An already activated test consumerWollette's test-account provisioning
Android toolchainJava 17, API 24+, compileSdk 35; the project declares its Gradle/Kotlin dependencies

Confirm these inputs before running. The supported production package/version and public-key enrolment route remain Wollette requirements; see installation and developer key setup.

Firebase and device association are separate from this initial wallet read. Add them before using features that require them. A successful read does not prove wallet activation is complete.

The minimal starter imports approved development key files through the system picker. Existing-app components read an installed key. The original complete starter uses bundled development credential files. Follow the credential path for the example you chose; production provisioning still needs Wollette approval.

Run the repository starter

Use an authorised SDK checkout at b68c5259a3953e90afe000f4ea0a699b0f4fd9fc. Open examples/android in Android Studio with Java 17 and Android SDK 35, then select the consumer-app module. The source-only download also requires that checkout; follow its README before building.

From the SDK repository root:

Shell
./android/gradlew -p examples/android :consumer-app:assembleDebug
  1. Have Wollette register wollette-consumer-demo://login. The app manifest and SDK configuration use that URI; change all three together for your app.
  2. Enter the approved API origin, hosted-login origin, DeveloperId and app-specific Keystore alias on screen.
  3. If the signing key is not already installed for this app, select the approved PKCS#8 private-key DER and matching X.509 certificate DER with the two file pickers. Select Install test signing key. Confirm Wollette has enrolled the matching public material.
  4. Select Sign in and read wallet and complete hosted login.
  5. Expected: Wallet: <id>. Refresh wallet uses the saved SDK session; Log out clears consumer state and retains the developer key.

The screen is examples/android/consumer-app/src/main/kotlin/com/wollette/starter/ConsumerStarterActivity.kt. Configuration fields are not persisted. After restart, enter the same values and use Refresh wallet. Android does not cancel login merely because the browser pauses the Activity.

Only use approved development keys. The picker does not bundle or upload private-key bytes; temporary selected bytes are cleared after installation or screen destruction. An emulator with test keys may fail device-security checks; use an approved stock device without bypassing the checks.

This app and its callback manifest built in the 6 November main-branch CI run. Live sign-in, server enrolment and wallet reads remain untested. It has no activation UI. Continue below only if you chose the original complete starter, whose callback, file layout and balance controls differ.

Original complete starter

The following numbered steps apply only to the original complete starter download, built on 2 November against 8cf5088. They do not configure the minimal repository app above.

1. Open and configure the starter

  1. Connect the authorised SDK checkout with prepare-sdk.py, following the bundle README.
  2. Open android-consumer/ in Android Studio.
  3. Copy app/src/main/assets/wollette.properties.example to wollette.properties and set the approved API/login origins.
  4. Supply the credential assets from controlled build storage:
AssetFormat
developer-idDeveloperId on one line
developer-private-key.derRSA PKCS#8 DER
developer-certificate.derMatching X.509 DER certificate

The complete DeveloperCredentials.kt and WolletteProvider.kt are included. They import the key and generate a fresh signed nonce for each API attempt. See conversion and import instructions.

Checkpoint: Gradle builds the app and the imports resolve. Missing assets are reported when the app starts its first action; compilation alone does not validate credentials.

2. Register the callback and create the SDK

Have Wollette register wollette-docs-consumer://callback for this test app. The starter's manifest and DemoApp.kt use the same value. Change all three together when adopting your own callback.

The library declares LoginRedirectActivity with exported=false. The app's external login callback must explicitly override that value. The complete starter manifest includes:

XML
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <application>
        <activity android:name="com.wollette.LoginRedirectActivity"
            android:exported="true" tools:replace="android:exported">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="wollette-docs-consumer" android:host="callback" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Merge this into your existing manifest; the starter already supplies its application and main activity. DemoApp imports credentials and creates one SDK/provider pair off the main thread. The bundled private-key copy remains extractable from the distributed app; see key handling.

3. Sign in and read the wallet

Run the app on a supported device and select Sign in and read balance. MainActivity.kt opens hosted login, then calls the wallet read. This excerpt runs after the retained SDK/provider have been initialised:

Kotlin
app.sdk.login(this@MainActivity)
val wallet = withContext(Dispatchers.IO) {
    app.sdk.wollette.retrieve(app.provider)
}

The full file includes imports, controls, cancellation and typed error handling. See login and Wallet.retrieve for the contracts.

Check the result

CheckpointExpected result
Hosted login completesBrowser returns to this app
Wallet read succeedsWallet read succeeded, followed by the returned currency and amount
Balance is omittedWallet read succeeded; balance unavailable
App restarts with a valid stored sessionRead with saved session fetches without opening login
Sign-out succeedsSDK cleanup completes; the developer key is retained

No example balance is fabricated and a missing balance is never treated as zero. Format currency for the production locale in your app.

Troubleshooting

SymptomCheckNext action
Gradle cannot find the SDK.sdk link, authorised checkout and pinned revisionRun prepare-sdk.py and sync again
Manifest merge rejects exportedApp callback activity has tools:replace="android:exported" and the tools namespaceUse the supplied manifest override
Credential setup failsAsset names, PKCS#8 key, matching X.509 certificate and DeveloperIdCorrect setup before retrying sign-in
Login does not returnApproved callback matches manifest and SDK configurationCorrect the three matching values
UNAUTHORIZEDSession expired, wrong token type or wrong environmentSign in again; host-managed sessions need host renewal
WALLET_NOT_READYTest consumer has no walletUse an activated test consumer or follow activation
DEVICE_COMPROMISEDDevice integrity checksStop protected work and use a supported device

Integrate into your existing app

Use the copyable integration components after installing the SDK and provisioning the signing key. ConsumerWalletFeature creates and retains the SDK instance. Use that feature as your app's SDK owner; replace any separate direct SDK service for the same consumer state.

ComponentPlace it inYour app supplies
ConsumerWalletFeatureYour app's long-lived service containerSDK configuration and signer; the screen owns its task
Platform ApiContextProvider helperSame service layerEnrolled DeveloperId and installed key alias/tag
DeveloperKeyImportApproved provisioning codeCorrect private-key bytes; Android also needs the matching local certificate
Existing screenYour UI/navigation layerOne active load action, visible result, cancellation and error handling

Keep the feature for the application's lifetime. A screen owns its coroutine/Task and ignores stale results on exit. Navigation away from the screen is different from signing out. The signer imports in the component examples use com.wollette.examples on Android; those helpers are example source, not SDK types.

Connect the Android screen

Copy these three Consumer files from examples/android/src/main/kotlin/com/wollette/examples/ in the component download into your app:

  • ConsumerWalletFeature.kt — retained wallet service.
  • KeystoreApiContextProvider.kt — signer using the installed key alias.
  • DeveloperKeyImport.kt — provisioning/import helper.

Retain com.wollette.examples or adapt the package and imports consistently. Exclude PosAssociationFeature.kt: it uses the separate POS dependency and belongs to a merchant app. After key provisioning, create the Consumer service once:

Kotlin
import com.wollette.examples.ConsumerWalletFeature
import com.wollette.examples.KeystoreApiContextProvider

val provider = KeystoreApiContextProvider(developerId, keyAlias)
val feature = ConsumerWalletFeature(applicationContext, config, provider)

developerId, keyAlias and config are your approved values. Use the exact installed alias. The complete starter's importer uses wollette-developer-key-v1; a separately provisioned app uses its agreed alias. Keep the callback declaration from step 2 and match its manifest, configuration and server registration.

Call feature.signInAndRead(activity) from the foreground screen's coroutine, or feature.refresh() after hosted sign-in. Display the returned wallet and handle WolletteException; propagate CancellationException. The helper performs wallet reads on IO. Disable repeated loads while the action is active. Cancel when the screen is discarded; Activity pause for the sign-in browser is expected.

For host-managed authentication use feature.read(accessToken, authorizationId, expirySeconds) with a current consumer session; your authentication service owns renewal. After restart recreate the feature and signer with the same configuration. Refresh the stored hosted session, handling sign-in-required errors. On explicit logout cancel screen work and call feature.logout(), then handle your own UI/session state.

Next steps

The starter build status is recorded in the download. A clean app build checks native integration code; approved login, bank/identity-provider returns and real-device payments still require acceptance testing.