Keys and environments in Desmo
Desmo uses API keys to identify who is sending data and which environment it belongs to. At a high level:- Publishable keys (start with
pk_) are used by the Android and iOS SDKs in your apps. - Secret keys (start with
sk_) are used only by your backend and internal tools.
sandbox– for development and test traffic.live– for production deliveries.
Configuring the Android SDK with a key
When you callDesmo.setup, you pass your publishable key and an environment:
- The key must start with
pk_, otherwiseDesmoConfigthrowsDesmoClientError.InvalidApiKeyand setup will fail. - The key is sent on every HTTP request in the
Desmo-Keyheader:
sk_...) keys in your app—those belong only on your backend.
Choosing an environment
TheDesmoEnvironment type controls which Desmo backend the SDK talks to:
SANDBOX and LIVE point to https://api.getdesmo.io, but they are treated as separate environments in the control plane (keys, tenants, projects).
Recommended usage:
- Use
SANDBOXduring development and QA. - Use
LIVEin your production app.
Rotating and revoking keys
When you create or revoke keys in the dashboard:- Existing apps using an old publishable key will continue to work until you revoke that key.
- Once revoked, requests using that key will start failing with authorization errors.
- Create a new publishable key for the environment you need.
- Update your app configuration (or remote config) to use the new key.
- Ship an app update and wait for adoption.
- Revoke the old key once you are confident no important traffic is using it.
Security guidelines
- Treat keys as credentials:
- Do not commit real keys into public repos.
- Prefer using Gradle properties, environment variables, or a remote config system to inject keys.
- Never log keys in production logs.
- Use separate keys for sandbox and live environments to avoid test data mixing with real deliveries.
Permissions recap
The SDK expects your app to grant location permissions so sessions can be tied to real-world deliveries.- Declare
ACCESS_FINE_LOCATIONandACCESS_COARSE_LOCATIONin yourAndroidManifest.xml. - At runtime, use
Desmo.getRequiredPermissions(),Desmo.hasRequiredPermissions(context), andDesmo.getMissingPermissions(context)to check and request what’s needed.