Skip to content

Latest commit

 

History

History
126 lines (80 loc) · 2.65 KB

File metadata and controls

126 lines (80 loc) · 2.65 KB

Integrate Whatfix SDK in your Android project

This article explains how to install and update the Whatfix Android SDK in your project.

Prerequisites:

  • Android Studio

  • Android version: 7.0 & later (API level/SDK version 24 & later)

Integration:

Step 1: Update

You need to insert your API key. Go to a file named local.properties and find the value of ent_name and ent_id. Replace " " with "YOUR-ENT-NAME" and "YOUR-ENT-ID" respectively.

ent_name = "YOUR-ENT-NAME";
ent_id = "YOUR-ENT-ID";

To get your ENT ID & ENT NAME, email us at support@whatfix.com or get in touch with your Account Manager.

Step 2: Add Whatfix Maven repo URL in your build

Add maven { url 'https://jitpack.io' }in Gradle root

 repositories { 
   maven {
 
       url  'https://jitpack.io'
 
   }
}

Step 3: Add the Whatfix SDK dependency 

Add bintray link in the app gradle dependency.

To add Whatfix dependency to your project, specify the following dependency configuration in the dependencies block of your build.gradle file.

implementation 'org.bitbucket.whatfix:whatfix-android:$sdk-version'

where $sdk-version is the latest version of the SDK available which is 

Step 4: Initialize Whatfix in your project

Initialize Whatfix in your Application class using the <ent_name> and <ent_id> provided to you.

If already updated in local.properties file, do nothing.

ELSE

Java:

    Whatfix.initialize(this, "<ent_name>", "<ent_id>" );

Kotlin :

Whatfix.initialize(application, "<ent_name>""<ent_id>")

Replace <ent_id> & <ent_name> with your Whatfix account ID and NAME .

Other APIs

  1. Set your custom host to serve content. Default is cdn.whatfix.com

Java:

    Whatfix.setCustomContentLocation("test.whatfix.com");

Kotlin:

    Whatfix.setCustomContentLocation("test.whatfix.com")
  1. Set the current user role from your app.  Java:
    Whatfix.setLoggedInUserRole("manager");

Kotlin:

    Whatfix.setLoggedInUserRole("manager")
  1. Set the current user id for analytics

Java:

    Whatfix.setLoggedInUserId("john_doe");

Kotlin:

    Whatfix.setLoggedInUserId("john_doe")
  1. Set the current user language preference

Java:

    Whatfix.setLanguage("fr");

Kotlin:

    Whatfix.setLanguage("fr")