Kony Installation

Interested in getting notified when we release new SDK updates? Subscribe to updates via our email list.

❗️

In the instructions below, remember to replace your app ID with the ID of the environment to which you want to send data. You can find this ID on the Account > Manage > Projects page.

Base Installation

📘

If you are using a Windows platform to build Android apps, Heap requires your SDK version to be 1.4.1 or above.

To set up Kony for Android, complete the following steps:

  1. Access the Kony Visualizer Project Settings, and navigate to the Native > Android Mobile/Tablet section
  1. In the Gradle Entries dialog, add the snippets below:

build.gradle entries to Prefix:

buildscript {
  ext.heapVersion = '1.2.0'
  repositories {
    jcenter()
  }
  dependencies {
    classpath "com.heapanalytics.android:heap-android-gradle:${heapVersion}"
  }
}

apply plugin: 'com.heapanalytics.android'

build.gradle entries to Suffix:

android {
  defaultConfig {
    ext {
      heapEnabled = true
      heapAutoInit = true
      heapEnvId = "<your-env-id>"
    }
  }
}

dependencies {
  implementation "com.heapanalytics.android:heap-android-client:${heapVersion}"
}
  1. Ensure the minimum SDK version is set to 23 or lower.

  2. Add the Ant task snippet below to your androidprecompiletask.xml Ant build file.

If you don’t have this file in your project, follow these instructions from Kony on how to add it:

A template androidprecompiletask.xml file is available at \temp`\build\luaandroid\extres`. This XML is available under extres folder after building any sample project. This XML file contains build parameter information useful to perform the tasks explained in the example above.

Ant task to add in androidprecompiletask.xml:

<replaceregexp file="${app.dir}/gradle/wrapper/gradle-wrapper.properties"
               match="^(distributionUrl=.*)gradle-4[.][0-7][^0-9].*"
               replace="\1gradle-4.8-bin.zip"
               byline="true"/>

Troubleshooting Kony Implementations

User or event properties are not populating on Android

When implementing Heap.addUserProperties() or Heap.addEventProperties() APIs in Kony-based Android apps, special care must be taken to ensure that the property values are Strings. Kony enables native Java SDKs and APIs to be used through their Native Function APIs feature:

var heap = java.import('com.heapanalytics.android.Heap');
var propMap = java.import('java.util.HashMap'); 
var props = new propMap();
props.put("userprop_int", 12345 + ""); // NOTE: Must ensure that the value is a string
props.put("userprop_string", "foobar");
heap.addUserProperties(props);

If proper care is not taken to ensure that properties are added as strings, the APIs may fail to execute correctly.

Updated 2 months ago

Kony Installation


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.