This document is just a quick start introduction to Liquid SDK for Android. We recommend you to read the full documentation at https://www.onliquid.com/documentation/android.
To integrate Liquid in your app, just follow these simple steps below.
// build.gradle file
dependencies {
// Your Dependencies
compile 'io.lqd:liquid-android:2.1.1@aar'
}
<!-- pom.xml file -->
<dependency>
<groupId>io.lqd</groupId>
<artifactId>liquid-android</artifactId>
<version>2.1.1</version>
</dependency>
- Clone Liquid SDK for android.
- Import the project to Eclipse (or other IDE).
- Add Liquid to your Application Project as a library.
<!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
In your onCreate()
callback method initialize the Liquid Singleton
Liquid lqd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lqd = Liquid.initialize(this, "YOUR_APP_TOKEN");
}
If your app supports applications with minSdkVersion
< 14, you need to add the methods below to your activities that use Liquid.
@Override
public void onResume() {
super.onResume();
Liquid.getInstance().activityResumed(this);
}
@Override
public void onPause() {
super.onPause();
Liquid.getInstance().activityPaused(this);
}
@Override
public void onStop() {
super.onStop();
Liquid.getInstance().activityStopped(this);
}
@Override
public void onStart() {
super.onStart();
Liquid.getInstance().activityStarted(this);
}
@Override
public void onDestroy() {
super.onDestroy();
Liquid.getInstance().activityDestroyed(this);
}
If all your users are anonymous, you can skip this step. If not, you need to identify them and define their profile. Typically this is done at the same time your user logs in your app (or you perform an auto login), as seen in the example below:
lqd.identifyUser("USER_ID");
The username or email are some of the typical user identifiers used by apps.
You can track any type of event in your app, using one of the following methods:
lqd.track("Bought Product");
You can transform any old-fashioned static variable into a "liquid" dynamic variable just by replacing it with a Liquid method. You can use a dynamic variable like this:
mWelcomeMessage.setText(liquid.getStringVariable("welcome_message", "Default Welcome!"));
We recommend you to read the full documentation at https://www.lqd.io/documentation/android.
Liquid Data Intelligence, S.A.
Liquid is available under the Apache license. See the LICENSE file for more info.