Android SDK
Add network-based Number Verification to an Android app in a few lines. The SDK does the device-side work.
Overview
Network-based Number Verification (NV1) proves a number without a password or an SMS code.
The device visits the authorization endpoint over cellular, the operator network confirms the source address belongs to the number, and a short-lived code comes back for the app's own server to redeem. The app's server keeps the OAuth secret and calls CAMARA. The number you check reaches the SDK and is forwarded to your server; the SDK never holds a secret and does not persist or log the number. This page documents the Android SDK surface and ships a dependency-free reference backend so an integrator can see both halves of the flow.
How it works
Three moves: your server starts the request, the SDK proves the number over mobile data, your server finishes it.
start (your server)
Push the authorization request (PAR) for the number, with PKCE and a state, and return where the device must go.
authorize (the SDK)
Open that URL bound to the cellular network and read the redirect without following it. The operator sees the mobile data address and answers with a code or an error.
finish (your server)
Redeem the code with PKCE and call CAMARA verify, then return match or mismatch to the SDK.
Add the SDK
The NV1 client ships in the partner-client artifact, from the PAiCore Maven repository.
minSdk 24. The NV1 path needs two normal permissions in your manifest, granted at install (no runtime prompt):
Quick start (Android)
Implement Nv1Backend with two calls to your own server, pass the expected Authorization Server, then call verifyNumber. That is the whole app-side integration.
What the placeholders are, all yours:
myServer.startNv1/myServer.finishNv1: your app's HTTP calls to your own backend, which are the reference backend'sPOST /nv1/startandPOST /nv1/finish.Nv1Config(authorizationServer = ...): the PAiCore Authorization Server origin the operator gives you. The SDK refuses an authorization URL from any other host.proceed(),notThisDevice(),handle(reason): your app's own functions for a match, a mismatch and a failure.
Outcomes
verifyNumber returns one value, never an exception.
| Result | Meaning |
|---|---|
Verified(matches = true) | The mobile data session belongs to the number. |
Verified(matches = false) | It does not: not this device's number. |
Failure(NoMobileData) | No cellular network to verify over. |
Failure(ConsentRequired) | The operator needs consent this network-only path cannot collect. |
Failure(TemporarilyUnavailable) | The operator could not answer now. Worth retrying. |
Failure(Network) | The mobile data path could not be reached. Worth retrying. |
Failure(InvalidCallback) | The callback was not the registered HTTPS redirect, or carried the wrong state. |
Failure(ServiceError(detail)) | Your server or the authorization server reported an error. detail is a safe marker only. |
A wrong data subscription, a VPN or Wi-Fi path, or an unsupported operator are not distinguished on the device: they end as a mismatch or a service error. The real route guarantee is validated on a device against a real operator.
The reference backend
The SDK never holds a secret, so the OAuth confidential-client credentials, the PKCE verifier, the code redemption and the CAMARA call all live on your server. The file below is a complete, dependency-free Node.js reference (Node 18+) of exactly those responsibilities.
It binds to 127.0.0.1 by default, speaks plain HTTP, and does not authenticate or rate-limit its endpoints. Before putting it on a reachable host, terminate TLS, authenticate the app that calls it, rate-limit per app and per number, and move attempts to a shared, expiring store.
What it is responsible for
- start: push the authorization request for the number (PAR), create the PKCE pair and the state, remember the attempt, and return the authorization URL, the redirect URI and the state.
- finish: check the code and state against the stored attempt (single use, not expired), redeem the code with PKCE, and call
POST /number-verification/v1/verify. - Number handling: the number arrives from the app, is kept in memory for the attempt only, is used in the PAR (
login_hint) and the CAMARA call, and is never logged.
OIDC: this reference uses only the access token for CAMARA, so it does not request openid and sends no nonce. A backend that needs OIDC identity assurance would add them and validate the id token's nonce in finish.
device-phone-number: this reference implements verify only. CAMARA GET /number-verification/v1/device-phone-number is a separate operation that you add on your own backend the same way when a client needs it (it needs the number-verification:device-phone-number:read scope and may need a fresh authorization or token); the SDK already carries Nv1Verification.devicePhoneNumber for it.
Run it
Source
Security & privacy
- The number, handled with care. The number you pass to
verifyNumberreaches the SDK and is forwarded to your backend; the SDK does not persist or log it. Your backend keeps it in memory for the attempt and uses it in the PAR and the CAMARA call. No OAuth secret and no access token ever reach the device. - Trusted destination. The SDK sends the authorization request only to the Authorization Server origin you configure, over HTTPS, so a mistaken or tampered backend cannot redirect the device elsewhere.
- Strict callback. The SDK accepts the redirect only from the exact registered HTTPS endpoint (scheme, host, port, path and any static query it carries), rejects duplicated
state,codeorerror, and compares the state in constant time. - Single use. The backend consumes each attempt once, so a code and state cannot be replayed.
- Clean logs. Neither the SDK nor the reference backend logs a number, code, token or request URI.
- No silent fallback. When verification cannot be done over mobile data, the SDK says so and stops. Whether to try an SMS code or another method is the app's product decision.
Status & external acceptance
This covers the SDK and the reference backend. The following are tracked separately and must not be presented as already verified:
Confirm on a device with a real SIM or eSIM that the request leaves over the intended operator's mobile data and that the source address the server observes correlates with the subscriber session, for IPv4, IPv6 and NAT.
Verify dual SIM, Wi-Fi, VPN, absent mobile data and an unsupported operator on supported Android versions. GSMA certification and conformance evidence remain later work.
On your own backend: the CAMARA device-phone-number operation, added the same way as verify (the reference backend is the template). Out of this cut: a Maven-published artifact consumed from a clean project, and Phase 2 (Credential Manager / OpenID4VP).