How to Use an Offline Token with the EloViewHome SDK
Audience: Android Application Developers and System Integrators
Article type: Public Integration Guide
An offline token is required when using EloViewHome SDK APIs that require authentication. The offline token is generated specifically for your Android application package name.
Requesting an Offline Token
If you do not already have an offline token, contact Elo Technical Support at elo.support@zebra.com and provide your application's Android package name.
Elo Support will provide a .prop properties file containing the credentials associated with your application. The properties file contains the application package name and the JWT offline token.
package_name=com.example.application
jwt=<offline_token>
⚠️ CRITICAL ATTRIBUTION WARNING
The offline token is strictly bound to the specified Android application package name. Ensure the exact package name provided to Elo Support matches your production application package name. Token verification will fail immediately if there is a mismatch.
Example Included with the EloViewHome SDK
The EloViewHome SDK includes both an EloViewHome Test App and the complete Test App source code. The source project provides an example of loading an offline token from a properties file and verifying it through the EloViewHome SDK.
In the Test App source, the properties file is stored in the application's assets directory. The application loads the properties file, retrieves the jwt value, and passes the token to the verifyEloToken() API.
val credentials = Properties()
credentials.load(
applicationContext.assets.open("your_application_jwt.prop")
)
val accessToken = credentials.getProperty("jwt")
AccountManager.instance.verifyEloToken(
applicationContext,
accessToken,
accessTokenHandler
)
Verifying the Token
The offline token is verified using the EloViewHome SDK AccountManager.verifyEloToken() API.
The SDK returns a token verification result through the supplied handler. A successful verification returns TOKEN_VERIFY_SUCCESS. If the token cannot be verified, the SDK returns TOKEN_VERIFY_FAIL.
💡 Common Token Verification Pitfalls (TOKEN_VERIFY_FAIL):
- The token payload is corrupt or poorly formatted.
- The token expiration epoch has passed (if set to non-permanent).
- The package name of the compiled application does not exactly match the certificate's metadata.
Using the Included Test App as a Reference
The EloViewHome Test App included with the SDK demonstrates the token verification process. In the Test App, navigate to:
Account Manager API > Load a file containing the credentials and verify > Load and Verify Token
The included Test App loads its example properties file directly from the application's assets rather than selecting a properties file from device storage. Developers should review the included Test App source code and use the Account Manager implementation as a reference when integrating offline-token authentication into their own application.
Additional Information
The EloViewHome SDK package includes:
- The EloViewHome SDK library
- An installable EloViewHome Test App
- The complete Test App source project
- EloViewHome SDK API documentation
Refer to the Test App source and the com.eloview.sdk.accountManager.AccountManager API documentation included with the SDK for additional implementation details.
Related Articles
Please report any broken links by emailing elo.support@zebra.com and include a link to the knowledge article