Top
Integrate Whatfix Mobile SDK with Cordova Android
  • 10 Oct 2023
  • 1 Minute To Read
  • Dark
    Light
  • PDF

Integrate Whatfix Mobile SDK with Cordova Android

  • Dark
    Light
  • PDF

Article Summary

To create Whatfix Mobile in-app experiences on your Cordova Android apps, you need to first set up Whatfix Mobile. You can add the Whatfix Mobile SDK provided for Cordova Android apps to the source code of your app and then create and publish content.

Integration steps for Cordova Android app

Use the following steps to integrate the Whatfix Mobile SDK in your Cordova Android project:

your title goes here

Ensure that you complete both the steps, to create and test the in-app experience in your integrated build.

Step 1: Integrate Whatfix Mobile plugin

a. Add the Whatfix Mobile dependency

Download the Whatfix Mobile Cordova Plugin package from npm using the following command:

cordova plugin add leap-cordova-android@1.8.8

b. Start the Whatfix Mobile SDK

To start Whatfix Mobile, add the following code inside onDeviceReady() {}.

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
    if(device.platform === 'Android') {
        cordova.plugins.LeapAndroid.start("<YOUR_API_KEY>");
    }
}

Step 2: Enable Creator mode in your app

To create in-app experiences in the Whatfix Mobile Studio, you have to enable the Creator mode in your app. This is done by integrating the Whatfix Mobile Creator Plugin.

a. Add dependencies

your title goes here
  • The Whatfix Mobile Creator Plugin must be removed before the app goes live on the Play Store.
  • While both Whatfix Mobile Creator SDK and Whatfix Mobile SDK need to be integrated in the development and testing versions, the production version should only have the Whatfix Mobile SDK.

Download the Whatfix Mobile Creator Cordova Plugin package from npm using the following command:

cordova plugin add leap-cordova-creator-android@1.8.8

b. Start the Whatfix Mobile Creator Plugin
To start the Whatfix Mobile creator, add the following code inside onDeviceReady() {}.

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
    if(device.platform === 'Android') {
        cordova.plugins.LeapCreatorAndroid.start("<YOUR_API_KEY>");
    }
}

Proguard Rules

If you are using Proguard for your builds, use the following rules in your proguard-rules.pro file,

-dontwarn is.leap.android.**

-keep class is.leap.android.** {*;}

If you are using Android Gradle Plugin (AGP) version 8.0 or newer, it may be necessary to include specific OkHttp rules in your proguard-rules.pro file. This step is crucial to ensure the proper execution of release builds, as the LeapCreator SDK relies on the OkHttp library. The required rules are as following:

#For Okhttp
-dontwarn okhttp3.internal.platform.** 
-dontwarn org.conscrypt.** 
-dontwarn org.bouncycastle.** 
-dontwarn org.openjsse.**

For more information, see Okhttp R8 / ProGuard.

After integrating the code, you can start creating your in-app experience using Whatfix Mobile.


Was this article helpful?


Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.