Integration

Add Your App to Your Dataset 

To add your app to your dataset in the Personalization UI, do the following.

  1. Log in to the Personalization UI and select the desired dataset.

    For an initial integration, we recommend using a non-production dataset.

    Note

  2. Click Settings and then + App.

    If this feature is disabled for your dataset, contact the Personalization support team to enable it.

    Note

  3. In the Platform dropdown menu, select Android.

  4. Enter a name for your app under App Name.

  5. Enter the Android applicationId (from the app’s build.gradle) under ApplicationId.

  6. Click Create New App.

    You can add up to 8 native apps to a single dataset. However, deleting an app doesn’t free up space for a new one.

    Important

Add the Personalization SDK to Your App 

To add the Personalization SDK to your app, do the following.

  1. In your project-level build.gradle file, include "https://maven.google.com" and mavenCentral() in your repository list, as shown in the following example.

    1repositories {
    2 // ... existing repositories like jcenter() etc
    3 mavenCentral()
    4 maven {
    5     // For nullability annotations from Android Support Library
    6     // See https://developer.android.com/topic/libraries/support-library/setup.html
    7     url "https://maven.google.com"
    8 }
    9}
  2. In your app’s module-level build.gradle file, include the latest version of Personalization as a dependency, as shown in the following example.

    1dependencies {
    2 // ... existing dependencies
    3 compile('com.evergage.android:evergage-android-sdk:1.2.3@aar') { transitive = true }
    4}

Initialize and Start Personalization in Your App 

For sample code to call in your Application.onCreate() implementation to initialize and start the Personalization SDK, see the Evergage class documentation.

Configure Personalization URL Scheme 

To effortlessly manage test campaigns from the device in debug/debuggable builds, you must configure the app to use its Personalization-generated URL Scheme. For more information, see EvergageActivity.

User Detail 

You can use other methods to add information about the user. In the initialization example code, calling setUserId provides Personalization with the user’s authenticated ID. If the user’s ID is unknown at startup, you could call this method later to then send the user’s ID with subsequent events.

Attach Sources in Android Studio 

Only supported by recent versions of Android Studio and Gradle.

Note

Android Studio automatically downloads and attaches the Personalization Android SDK sources. Press the Command key (OSX) or Ctrl key (Windows) and click a non-internal Personalization class or method to go to the declaration and view the source.

If sources were not automatically added, you could manually attach the -sources.jar by doing the following.

  1. Download the -sources.jar from Maven Central.
  2. On the left sidebar, open the Project Pane and select the Project view from the dropdown menu. The default view is Android.
  3. Under External Libraries, right-click the Personalization library (evergage-android-sdk-1.3.0) and select Library Properties.
  4. Click the + icon in the bottom left corner.
  5. Select the downloaded JAR file and click OK.

You can follow the same steps to attach the -javadocs.jar file and view the documentation locally. You could also view the documentation locally by downloading the -javadocs.jar from Maven Central and opening index.html.

Next 

  • To get started with tracking events and sending them from your app to Personalization, see Tracking.