Retrieving Esper Device ID (EsperID) from an Android App using the Device SDK
Android
Title: Retrieve the Esper Device ID from an Android app using the Device SDKWhen your Android application needs to identify the device it is running on at runtime, you can retrieve the Esper Device ID (EsperID) programmatically using the Esper Device SDK.
Why this happens
The EsperID is assigned by Esper at enrollment time and is not exposed through standard Android APIs. The Esper Device SDK provides a dedicated method to surface this identifier to your app while the device is under active Esper management.
Before you begin
- An Android application project ready for SDK integration
- Administrator access to the Esper Console to generate an API key
- A device already enrolled and actively managed by Esper
Steps
-
Generate an API key in the Esper Console. Navigate to Esper Console → API Key Management (under your tenant settings), create a new key, and save the value securely. This key authenticates the SDK against your Esper tenant.
Note: Embedding API keys directly in a client-side Android app exposes credentials. Review key permissions carefully and consider using a backend service to fetch sensitive data instead of storing the key in your app binary. - Add the Esper Device SDK to your Android project. Follow the Esper Device SDK integration guide to declare the SDK dependency and configure your build files.
- Initialize the SDK in your application. Pass the API key generated in Step 1 and your tenant URL to the SDK initializer. Refer to the SDK setup documentation for the exact initialization call — initialization must succeed before any SDK methods can be called.
-
Call
getDeviceId()to retrieve the EsperID. Invoke this method at runtime within your application. The returned value matches the EsperID shown on the device home screen in the Esper Launcher and in Esper Console → Devices & Groups → [Device Name].
getDeviceId() should exactly match the EsperID displayed on the device's home screen and in the Esper Console device detail page. If the values match, the SDK is initialized correctly and the device is being identified as expected.
Common issues
- SDK fails to initialize: Confirm the API key is valid and has not been revoked in Esper Console → API Key Management. Verify the tenant URL used during initialization is correct for your Esper account.
-
getDeviceId()returns null or an error: Confirm the device is actively enrolled and managed under the same Esper tenant as the API key. A device that has been unenrolled or is in an inactive state will not return a valid EsperID. -
Retrieving the device alias instead of the EsperID: The device alias is not available through the Esper Device SDK. To retrieve it programmatically, call the Esper Cloud REST API endpoint
GET /v0/enterprise/{enterprise_id}/device/from a backend service. Do not call this endpoint directly from the device app.
If this doesn't resolve it
If the SDK fails to initialize or getDeviceId() continues to return unexpected results, contact Esper Support. Include the following when you reach out:
- The Esper Device SDK version your project is using
- The full error message or stack trace from your application logs
- The EsperID of the affected device, visible in Esper Console → Devices & Groups → [Device Name]
- Confirmation of whether the device is actively enrolled and managed
Still need help?
If you're still having trouble retrieving the EsperID from your Android app, please submit a support ticket and include your app's package name, the Device SDK version you're using, and any error messages you're encountering.
Please sign in to leave a comment.
Comments
0 comments