SDK Integration

Please note that the Hengam plugin is dedicated to Android games and should be selected in the Android platform project.

Here you can find simple way of implementing Hengam SDK using Unity for android and iOS(coming soon).

This guide assumes that you've already followed the prerequisites.

[Android] Installation on your project

Import the Plugin

  1. Download the Hengam plugin for Unity file.

  2. Double click on it when project is open to be imported or right click on Assets and import it as a custom package.

Adding the Hengam SDK

If the program does not have a mainTemplate.gradle file, copy this file from the Hengam/Setup folder to Assets/Plugin/Android.

If this file already exists, add the following code to your mainTemplate.gradle file:

  • Include the repository
allprojects {
   repositories {

      // Hengam Extended plugin
      maven { url '' }

      flatDir {
        dirs 'libs'
  • Add the Hengam library:
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Adding Hengam
    implementation ('io.hengam.lib:unity-extended:0.2.0')
    // MultiDex -- Add it in case of method count overhead if your MINSDK is lower than 21 
    implementation ''


If you use hengam's mainTemplate.gradle file, It will do the trick and just do number (3) of below options.

If you came up with multiDex error, you should do various things. But with Hengam:

  1. Add multiDexEnabled true to defaultConfig of mainTemplate.gradle
  2. Add multiDex support library dependency in dependencies block.
  3. Override your AndroidManifest with io.hengam.lib.ext.HengamMultiDexApplication as android:name in <application> tag attributes.


Go to Hengam dashboard and get the manifest token and add it to your project AndroidManifest.xml

The manifest will be a tag like this:

   <meta-data android:name="hengam_token" android:value="HENGAM_TOKEN" />

The value HENGAM_TOKEN is a sample. Replace it with your own token which is a unique token, available in Hengam dashboard for your app.

Test & diagnosis

You do not need to add any special scripts to run the Hengam registry operation. Just run the app.

Hengam needs minimum android api=15 and google-play-service version >= 3 to run.

After running the application, you should see the following logs in Unity. (this may take a few seconds due to the connection to the server):

Resolution succeeded

After that,

  1. Run and install your app on a test device or emulator that has google-play-service installed.
  2. Make sure your device is connected to internet.
  3. Open the app and wait until your installation is received by the hengam. We will send you a notification and an email whenever we receive the first installation.

Too long? check the troubleshooting section. Your problem may be found there.


If you have any problem, please contact us using this email, we will get back to you right away: hi [at]