Blitzllama Documentation
  • About Blitzllama
  • Quickstart Guides
    • Creating Surveys
    • Creating Quizzes
    • Targeting Essentials
    • Customization & Personalization
    • Extracting Insights from Surveys
    • Core Concepts
  • PLATFORMS
    • Android
    • iOS
    • Web
    • React Native
    • Flutter
    • Google Tag Manager
    • Links
    • API
  • Connections - Sources
    • Mixpanel
    • CleverTap
    • Segment
    • Amplitude
    • RudderStack
    • Backend Triggers
    • Hightouch
  • Connections - Destinations
    • Amplitude
    • CleverTap
    • Mixpanel
    • Segment Streams
    • Zapier
    • Slack
    • Webhook
    • Export APIs
  • ORGANIZATION
    • Team Members & Projects
    • MTU Sampling
  • Eureka - Connections
    • Zendesk
    • Freshdesk
    • Intercom
    • Play Store
    • Appstore
Powered by GitBook
On this page
  • Overview
  • Getting Started
  • Before You Begin
  • Quick Start (5 Minutes)
  • 1. SDK Installation
  • 2. Update AndroidManifest
  • 3. Initialize the SDK
  • 4. Create a User
  • 5. Trigger a Survey
  • Triggers and Event Properties
  • What are Triggers?
  • Adding Trigger Properties (Optional)
  • Personalizing and Localizing Surveys
  • Setting User Attributes
  • Setting Survey Language
  • User Management
  • Logout
  • Advanced Features
  • Survey Completion Callback
  • Performance Impact
  • FAQ & Troubleshooting
  • Next Steps

Was this helpful?

  1. PLATFORMS

Android

PreviousCore ConceptsNextiOS

Last updated 4 months ago

Was this helpful?

Overview

The Blitzllama Android SDK enables you to deliver in-product surveys directly inside your Android app. By integrating the SDK, you can collect targeted user feedback at critical moments in the user journey.

Key Features:

  • Quickly embed surveys via triggers you define in your app.

  • Identify and track users to ensure they don’t receive duplicate surveys unnecessarily.

  • Personalize surveys with user attributes and event properties (optional).

  • Localize surveys by setting different languages (optional).

Requirements:

  • Android 5.0 (API level 21) and above.

  • Java 8 compatibility (source and target).

  • Access to the Blitzllama dashboard (to retrieve your API key and manage triggers).

Getting Started

Before You Begin

  1. Obtain Your API Key: Log in to the Blitzllama dashboard, navigate to Connections Tab, click Android, and find your API_KEY.

  2. Confirm Minimum SDK: The SDK officially supports API level 21 and above. If your minSdk is below 21, override the library in your AndroidManifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.myapp"
    xmlns:tools="http://schemas.android.com/tools">

  <uses-sdk tools:overrideLibrary="com.blitzllama.androidSDK" />
    ...

Quick Start (5 Minutes)

1. SDK Installation

Add the SDK to your app/build.gradle and enable Java 8 (if not already):

// app/build.gradle
dependencies {
    implementation 'com.blitzllama:Blitzllama:1.9.1'
}

android {
  ...
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  // For Kotlin projects
  kotlinOptions {
    jvmTarget = "1.8"
  }
}

We recommend using AppCompatActivity while using the SDK, otherwise the surveys won't show up HomeActivity extends AppCompatActivity{ }

2. Update AndroidManifest

Declare your Blitzllama API key:

AndroidManifest.xml
<application>
    <meta-data 
    android:name="blitz_api_key"  
    android:value="API_KEY" />
</application>

3. Initialize the SDK

Create or update your Application class and extend BlitzLlamaSDK:

public class MyApplication extends BlitzLlamaSDK {
    @Override
    public void onCreate() {
        super.onCreate();
        BlitzLlamaSDK.init(this);
    }
}        
override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        BlitzLlamaSDK.init(this);
        }

NOTE: If you are registering the activity lifecycle in your application class, please make sure to call the SDK's init function below that.

4. Create a User

Ensure you create a user with a unique ID before triggering surveys:

BlitzLlamaSDK.getSdkManager(this).createUser("user_id");
BlitzLlamaSDK.getSdkManager(this).createUser("user_id")

5. Trigger a Survey

Add a trigger event to display surveys:

BlitzLlamaSDK.getSdkManager(this).triggerEvent("trigger_name")
BlitzLlamaSDK.getSdkManager(this).triggerEvent("trigger_name")

You’re now ready to collect targeted user feedback with Blitzllama's in-app surveys! 🚀 Read further to check other capabilities of Blitzllama and customize to your requirement.


Triggers and Event Properties

What are Triggers?

Triggers are events in your app (e.g., button presses, screen loads) that prompt a survey if configured in the Blitzllama dashboard.

Adding Trigger Properties (Optional)

You can attach properties to a trigger event to provide additional context, such as screen names or user actions. These properties help refine your targeting.

HashMap<String, Object> eventProperties = new HashMap<String, Object>();
mapValues.put("event Key", "event Value");
mapValues.put("event Key1", "event Value1");

BlitzLlamaSDK.getSdkManager(this).triggerEvent("trigger_name",eventProperties)

Event schemas can be changed on the dashboard. You can use these properties to more filter users in the survey, as shown in the below screenshot.

Why Use Trigger Properties?

  • Filter users more precisely in the Blitzllama dashboard.

  • Understand user context when surveys are triggered.

Personalizing and Localizing Surveys

Setting User Attributes

Attributes help you segment and target specific user groups (e.g., plan type, user role). Allowed data_type values are "string", "number", "date", "boolean".

BlitzLlamaSDK.getSdkManager(this).setUserAttribute("attribute_name","attribute_value", "data_type");
BlitzLlamaSDK.getSdkManager(this).setUserAttribute("attribute_name","attribute_value", "data_type")

Set User Email or Name:

BlitzLlamaSDK.getSdkManager(this).setUserEmail("user_email_address");
BlitzLlamaSDK.getSdkManager(this).setUserName("user_name");
BlitzLlamaSDK.getSdkManager(this).setUserEmail("user_email_address")
BlitzLlamaSDK.getSdkManager(this).setUserName("user_name")

Setting Survey Language

To display surveys in the user's preferred language, set the survey language using an ISO 639-1 code (e.g., "en" for English, "es" for Spanish).

BlitzLlamaSDK.getSdkManager(this).setSurveyLanguage("language_code");
BlitzLlamaSDK.getSdkManager(this).setSurveyLanguage("language_code")

Why Set Survey Language?

  • Improve user experience by displaying surveys in the user's native language.

  • Supports better localization for global apps.

User Management

Logout

When a user logs out, call the logout method to clear their session and ensure subsequent events are not tied to the previous user’s data.

BlitzLlamaSDK.logout();
BlitzLlamaSDK.logout()

Why Logout?

  • Prevents mixing user data between sessions.

  • Ensures a clean state when switching users.

Advanced Features

Survey Completion Callback

Receive a callback when a user completes a survey. This can be useful for analytics or triggering follow-up actions.

Example:

import com.blitzllama.androidSDK.common.OnSurveyCompletionListener;
..
..

HashMap<String, Object> eventProperties = new HashMap<String, Object>();
mapValues.put("event Key", "event Value");

OnSurveyCompletionListener listener = result -> {
            Log.d("result",result.toString());
};

BlitzLlamaSDK.getSdkManager(this).triggerEvent("trigger_name",eventProperties,listener)

Sample Callback data

{
    "group_id": "g-d8ee8...",
    "survey_id": "s-d8ee8...",
     "event_name": "trigger name"
}

Performance Impact

Every release we extensively test our SDK in multiple sample apps across devices and Android versions for crashes and performance issues. The performance impact is negligible and below are the stats for the latest SDK version.

  • Load times: All calls are async and hence does not impact app or screen load times.

  • App size: Blitzllama SDK AAR size is 150kb and it's size impact on an Android app is about 200kb.

  • CPU usage: A negligible increase of 1-5% CPU usage only when the micro survey is on-screen.

FAQ & Troubleshooting

  • Survey not showing up?

    • Ensure createUser is called before triggerEvent.

    • Check that the event name matches exactly what’s configured in the Blitzllama dashboard.

  • Survey not showing up on the home screen or the first app page?

    • This might be a race condition, please pass a callback function as the second argument to createUser function.

import com.blitzllama.androidSDK.SdkInitialisationSuccessCallback
..
..
val clbk = object : SdkInitialisationSuccessCallback{
    override fun onSuccess() {
        BlitzLlamaSDK.getSdkManager(this@HomeActivity).triggerEvent("MainActivity")
    }

    override fun onFailure() {
        BlitzLlamaSDK.getSdkManager(this@HomeActivity).triggerEvent("MainActivity")
    }
}

BlitzLlamaSDK.getSdkManager(this).createUser("user_id", clbk);
  • Switching users?

    • Call BlitzLlamaSDK.logout() before creating a new user to avoid mixing sessions.

  • How to create triggers? There are two methods to create a trigger:

    1. Add new trigger_name in your app and it will automatically be created if it doesn't exist and then be available for selection in the dashboard.

    2.: To add a trigger into your app, first create a trigger on the Blitzllama dashboard with a trigger_name, then use the same trigger_name in the following function.

    Make sure to create a user before triggering a survey.

  • Need more help?

    • Reach out over the support chat or email tech@blitzllama.com.

Next Steps

  1. Start with adding 5 triggers for the most critical user actions in the app.

  2. Create your first survey on the Blitzllama dashboard.

  3. Customize the UI/UX of the survey on the Blitzllama dashboard.

You can also use backend events to launch in-app surveys. Check out for more details.

https://documentation.blitzllama.com/connections/backend-trigger