This article explains how to install and update the Whatfix Android SDK in your project.
-
Android Studio
-
Android version: 7.0 & later (API level/SDK version 24 & later)
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.
Add maven { url 'https://jitpack.io' }in Gradle root
repositories {
maven {
url 'https://jitpack.io'
}
}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
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 .
- Set your custom host to serve content. Default is cdn.whatfix.com
Java:
Whatfix.setCustomContentLocation("test.whatfix.com");Kotlin:
Whatfix.setCustomContentLocation("test.whatfix.com")- Set the current user role from your app. Java:
Whatfix.setLoggedInUserRole("manager");Kotlin:
Whatfix.setLoggedInUserRole("manager")- Set the current user id for analytics
Java:
Whatfix.setLoggedInUserId("john_doe");Kotlin:
Whatfix.setLoggedInUserId("john_doe")- Set the current user language preference
Java:
Whatfix.setLanguage("fr");Kotlin:
Whatfix.setLanguage("fr")