Example app

Build, run, and navigate the example app included with the Android SDK

The Exponea Android SDK includes an example application you can use as a reference implementation. You can build and run the app, test Engagement features, and compare the code and behavior of your implementation with the expected behavior and code in the example app.

Prerequisites

You must have the following software installed to be able to build and run the example app:

Build and run the example app

  1. Clone the exponea-android-sdk repository on GitHub:
    git clone https://github.com/exponea/exponea-android-sdk.git
    
  2. Open the exponea-android-sdk project in Android Studio.
  3. Open the file sdk/build.gradle and find the following line
    apply from: 'publish-maven.gradle'
    
    Comment it out so it look like this:
    //apply from: 'publish-maven.gradle'
    
  4. Run the example app on the Android emulator (Run > Run 'app' or Ctrl + R).

📘

To enable push notifications in the example app, you must also configure the Firebase integration or Huawei integration in the Exponea web app.

Navigate the example app

Example app screens: configuration, fetch, track, track event

When you run the app in the simulator, you'll see the Authentication view. Enter your project token, API token, and API base URL. Optionally, enter an email address hard ID in the Registered field to identify the customer. Then click Authenticate to initialize the SDK.

AuthenticationActivity.kt

👍

Make sure to prexif your API key with "Token ", for example:
Token 0b7uuqicb0fwuv1tqz7ubesxzj3kc3dje3lqyqhzd94pgwnypdiwxz45zqkhjmbf.

The app provides several views, accessible using the bottom navigation, to test the different SDK features:

Try out the different features in the app, then find the customer profile in the Engagement web app (under Data & Assets > Customers) to see the properties and events tracked by the SDK.

If you left the Registered field blank, the customer is tracked anonymously using a cookie soft ID. You can look up the cookie value in the logs and find the corresponding profile in the Engagement web app.

If you entered a hard ID (use an email address as value) in the Registered field, the customer is identified and can be found in Engagement web app by their email address.

📘

Refer to Customer identification for more information on soft IDs and hard IDs.

Example app screens: identify, flush, anonymize, content blocks

Troubleshooting

If you encounter any issues building the example app, the following may help:

  • In Android Studio, select Build > Clean Project, then Build > Rebuild Project.