Liquid SDK (Android)

Overview

Liquid Android SDK

Join the chat at https://gitter.im/lqd-io/liquid-sdk-android

Build Status Codacy Badge
Maven Central

Quick Start to Liquid SDK for Android

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.

Setup

Android Studio / Gradle (recommended)

// build.gradle file
dependencies {
  // Your Dependencies
  compile 'io.lqd:liquid-android:2.1.1@aar'
}

Maven

<!-- pom.xml file -->
<dependency>
    <groupId>io.lqd</groupId>
    <artifactId>liquid-android</artifactId>
    <version>2.1.1</version>
</dependency>

Eclipse

  1. Clone Liquid SDK for android.
  2. Import the project to Eclipse (or other IDE).
  3. Add Liquid to your Application Project as a library.

Start using Liquid

1. Add Permissions to Application Manifest

<!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>

2. Initialize Liquid Singleton

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");
}

3. Add Callbacks (mandatory if minSdkVersion < 14)

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);
	}

4. Identify a user (optional)

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.

5. Track events

You can track any type of event in your app, using one of the following methods:

  lqd.track("Bought Product");

6. Personalize your app (with dynamic variables)

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!"));

Full documentation

We recommend you to read the full documentation at https://www.lqd.io/documentation/android.

Author

Liquid Data Intelligence, S.A.

License

Liquid is available under the Apache license. See the LICENSE file for more info.

Comments
  • accept all map implementations for attributes

    accept all map implementations for attributes

    fixes https://github.com/lqd-io/liquid-sdk-android/issues/7

    A small change to make using the Liquid SDK easier. The SDK doesn't care what the underlying map implementation is.

    enhancement 
    opened by harkin 2
  • LQPushHandler can't find referenced method setLatestEventInfo

    LQPushHandler can't find referenced method setLatestEventInfo

    This is the error I'm seeing:

    Warning:io.lqd.sdk.LQPushHandler: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification

    In Android version 6, public void setLatestEventInfo(Context context, CharSequence contentTitle, CharSequence contentText, PendingIntent contentIntent) in android.app.Notification not longer exists.

    Instead of: https://github.com/lqd-io/liquid-sdk-android/blob/master/liquid/src/main/java/io/lqd/sdk/LQPushHandler.java#L19

    I believe it should be: import android.support.v4.app.NotificationCompat;

    And here:

    https://github.com/lqd-io/liquid-sdk-android/blob/master/liquid/src/main/java/io/lqd/sdk/LQPushHandler.java#L146

    Can be a NotificationCompat.Builder with all the variables "c, title, body, intent" added to the builder. NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder...

    bug 
    opened by DaleCantwell 1
  • Encoding UTF-8 Special Characters

    Encoding UTF-8 Special Characters

    Hi

    I've just detected an issue in you Android SDK regarding UTF-8 encoding of you requests.

    if (this.getJSON() != null) {
        connection.setDoOutput(true);
        final String data = new String(this.getJSON().getBytes(), "UTF-8");
        outputStream = new DataOutputStream(connection.getOutputStream());
        outputStream.writeBytes(data);
        outputStream.flush();
    }
    

    This part of code in LQNetworkRequest is not properly writing special characters in UTF-8 into the stream even if the String was in UTF-8. This call would return and HTTP 500.

    I tried a small test using the same data but changing the request to this

    if (this.getJSON() != null) {
        connection.setDoOutput(true);
        outputStream = new DataOutputStream(connection.getOutputStream());
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
        writer.write(this.getJSON())
        writer.close();
        outputStream.close();
    }
    

    Ran the test with both methods of writing to the buffer and the one I changed worked and returned an HTTP 200.

    Opened a pull request for this fix #33

    opened by pedrofmvcmartins 0
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    lqd-io/liquid-sdk-android now has a Chat Room on Gitter

    @letz has just created a chat room. You can visit it here: https://gitter.im/lqd-io/liquid-sdk-android.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
  • Fix an issue with Android M support

    Fix an issue with Android M support

    I don't have a solid setup for testing this branch. The update to 23 build tools is probably worth a solid bit of testing. The key to fixing the issue is to remove the method setLatestEventInfo as it is no longer available. https://github.com/lqd-io/liquid-sdk-android/issues/10

    Additional change: org.apache.http.entity.StringEntity is also no longer available. There are loads of potential options here. I went for:

        final String data = new String(getJSON().getBytes(), "UTF-8");  
        bout.write(data.getBytes());
    

    This is just to preserve the UTF-8 encoding. This code may work with simply

        bout.write(getJSON().getBytes());
    
    opened by DaleCantwell 0
  • prevent null identifier crash

    prevent null identifier crash

    fixes https://github.com/lqd-io/liquid-sdk-android/issues/8

    Switches the conditional to || so it can short circuit in the case where identifier == null

    Also removes the finalIdentifier string as it's identical to the identifier passed in

    bug 
    opened by harkin 0
  • Calling identifyUser with a null identifier leads to a crash

    Calling identifyUser with a null identifier leads to a crash

    The conditions at https://github.com/lqd-io/liquid-sdk-android/blob/master/liquid/src/main/java/io/lqd/sdk/Liquid.java#L370 should be ored together so it can short circuit when the identifier is null

    opened by harkin 0
  • Liquid could accept any map implementation for attributes

    Liquid could accept any map implementation for attributes

    It would be nice if Liquid didn't require HashMaps of attributes and instead took any implementation of Map.

    This opens up options like using the memory efficient ArrayMap to give attributes to Liquid or to just keep references to Map instead of HashMap in an app.

    opened by harkin 0
  • nice product, I dig...

    nice product, I dig...

    Do you guys have a REST API? to interact from a server programically, instead of using the gui?

    would one of the determining factors, in choosing a provider in this space.

    thanks!

    keeprockin!

    question 
    opened by sirvon 1
Releases(v2.0.2)
  • v2.0.2(Mar 2, 2016)

  • v2.0.1(Mar 2, 2016)

  • v2.0.0-rc5(Feb 1, 2016)

    • [enhancement] Update GCM handler.
    • [bugfix] NPE when no inapp messages.
    • [feature] declare on your manifest the push notification icon.
    • [change] Drop sessions (controlled in Liquid frontoffice).
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-rc4(Dec 7, 2015)

  • v2.0.0-rc3(Dec 3, 2015)

  • v2.0.0-rc2(Dec 3, 2015)

  • v2.0.0-rc1(Nov 5, 2015)

  • v1.2.1(Oct 9, 2015)

  • v1.2.0(Jun 1, 2015)

    • [feature] Add setUserAttributes() to set multiple user attributes
    • [bugfix] Fix NPE in softReset()
    • [bugfix] LiquidPackage loading on initialize
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(May 27, 2015)

    • [feature] Identifying a user no longer starts a new session
    • [feature] Keep User unique_id when calling resetUser(); in an anonymous user
    • [bugfix] Fix UUID generation when user is a time traveler
    • [bugfix] Fix push registration in SDK below API 21
    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Apr 22, 2015)

  • v1.0.0(Apr 21, 2015)

    • [feature] Add push notifications custom sound and title (configurable over Liquid dashboard)
    • [feature] Add option to set Logger level
    • [bugfix] Fix custom data points flush interval
    • [enhancement] Support GZIP requests
    • [enhancement] Improve stability and performance
    • [enhancement] Remove deprecated methods
    Source code(tar.gz)
    Source code(zip)
  • v0.8.3-beta(Sep 18, 2014)

    • [bugfix] Fix minor concurrency issue in track(); method.
    • [bugfix] Fix NullPointerException when getting connectivity status using emulator.
    • [enhancement] Performance improvements.
    Source code(tar.gz)
    Source code(zip)
  • v0.8.2-beta(Aug 25, 2014)

  • v0.8.1-beta(Jul 28, 2014)

  • v0.8.0-beta(Jul 23, 2014)

    • [feature] Add support to alias anonymous users with identified users.
    • [feature] Anonymous users are now automatically handled. If you never identify your user, all activity will be tracked anonymously. As soon as an user is identified, all that anonymous activity will be automatically aliased to the identified user.
    • [feature] When a user is identified, it is kept in cache for the next launch. This means that you don't need to identify each time you start the app again.
    • [bugfix] Fix a problem on HTTP Requests queue, that could cause duplication or loss of events.
    • [bugfix] Prevent starting new session when activity changes.
    • [enhancement] Better handling of background and foreground events.
    • [enhancement] Speed and stability improvements.
    • [enhancement] Improvements on event tracking dates that avoid two events tracked too quickly to be tracked in the wrong order.
    • [enhancements] The use of reserved names on Users and Events attributes will raise an assert under development environment (skipped/ignored attributes in production).
    • [change] Changed Device attributes from camelCase to underscore naming convention, and removed _ prefix (e.g: attribute _systemVersion was changed to system_version). This will not affect your queries on Liquid dashboard.
    Source code(tar.gz)
    Source code(zip)
  • v0.7.0-beta(Jun 3, 2014)

    • [feature] Invalid characters on attributes will raise an exception in development.
    • [deprecate] identifyUser(String identifier, Location location) and identifyUser(String identifier, HashMap<String, Object> attributes, Location location).
    • [deprecate] setUserLocation(Location l) -> UsesetCurrentLocation(Location l)` instead.
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0-beta(May 14, 2014)

Owner
Liquid
Automated formulas to increase mobile app engagement, retention and monetisation.
Liquid
Segmenkt - The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment

SegmenKT Kotlin SDK The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment. I

UNiDAYS 0 Nov 25, 2022
Frogo SDK - SDK Core for Easy Development

SDK for anything your problem to make easier developing android apps

Frogobox 10 Dec 15, 2022
HubSpot Kotlin SDK 🧺 Implementation of HubSpot API for Java/Kotlin in tiny SDK

HubSpot Kotlin SDK ?? Implementation of HubSpot API for Java/Kotlin in tiny SDK

BOOM 3 Oct 27, 2022
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

AWS Amplify 976 Dec 29, 2022
Countly Product Analytics Android SDK

Countly Android SDK We're hiring: Countly is looking for Android SDK developers, full stack devs, devops and growth hackers (remote work). Click this

Countly Team 648 Dec 23, 2022
Android Real Time Chat & Messaging SDK

Android Chat SDK Overview Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversational apps. We power emer

Applozic 659 May 14, 2022
Evernote SDK for Android

Evernote SDK for Android version 2.0.0-RC4 Evernote API version 1.25 Overview This SDK wraps the Evernote Cloud API and provides OAuth authentication

Evernote 424 Dec 9, 2022
Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Freshplanet 219 Nov 25, 2022
Android Chat SDK built on Firebase

Chat21 is the core of the open source live chat platform Tiledesk.com. Chat21 SDK Documentation Features With Chat21 Android SDK you can: Send a direc

Chat21 235 Dec 2, 2022
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

AWS Amplify 975 Dec 24, 2022
新浪微博 Android SDK

ReadMe 公告: 鉴于线上服务器出现问题,推荐下载本地aar后上传到自己公司的服务器,保证后续服务稳定, 我们也将尽快重新提供一个稳定的地址供大家使用。 新包地址:https://github.com/sinaweibosdk/weibo_android_sdk/tree/master/2019

SinaWeiboSDK 1.8k Dec 30, 2022
Official Appwrite Android SDK 💚 🤖

Appwrite Android SDK This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check previous releases. Appwrite is an ope

Appwrite 62 Dec 18, 2022
This App is sending Face capture data over network, built around the latest Android Arcore SDK.

AndroidArcoreFacesStreaming From any Android phone ArCore compatible, using this app will send over TCP 5680 bytes messages: The first 5616 bytes is a

Maxime Dupart 30 Nov 16, 2022
Trackingplan for Android SDK

With Trackingplan for Android you can make sure that your tracking is going as you planned without changing your current analytics stack or code.

Trackingplan 3 Oct 26, 2021
Desk360 Mobile Chat SDK for Android

Desk360 Chat Android SDK Introduction Desk360 Live Chat SDK is an open source Android library that provides live support to your customers directly fr

null 31 Dec 13, 2022
Storyblok Kotlin Multiplatform SDK sample (Android, JVM, JS)

storyblok-mp-SDK-sample *WIP* ... a showcase of the Storyblok Kotlin Multiplatform Client SDK. (Android, JVM, JS, iOS, ...) What's included ?? • About

Mike Penz 6 Jan 8, 2022
A demo of Rongcloud uniapp sdk integration for compiling debug-apk in Android Studio

Rongcloud-uniapp-sdk-demo A demo of Rongcloud uniapp sdk integration for compiling debug-apk in Android Studio 这是一个为了给uniapp在Android平台打出debug-apk的demo

Zongkui Guo 1 Oct 13, 2021
StreamPack: live streaming SDK for Android based on Secure Reliable Transport

StreamPack: live streaming SDK for Android based on Secure Reliable Transport (SRT) StreamPack brings the best audio/video live technologies together

guo shao hong 2 Aug 10, 2022
Judo Android SDK

Judo Android SDK Requirements: Android SDK/API level: Android API 23 or later (it will install in apps with minSDK as low as 19, but rendering is only

Judo 16 Nov 17, 2022