Install Android Sdk

This page will give detailed description of how you can integrate Growlytics android SDK to your native android app.

Use Growlytics Android SDK to track, analyze and engage user from native android apps.

Follow the guidelines to install the Growlytics Android SDK, track events, and see the event data within the Growlytics dashboard.

Step 1: Add Growlytics SDK to your project

Add growlytics-android-sdk dependency to your project.

For enable FCM support, you will need to add follwoing dependencies in your application’s build.gradle file. You will also have to add the FCM generated google-services.json file to your project.


{
    dependencies {
        implementation 'com.growlytics.android.sdk:growlytic-android-sdk:1.0.4'
        implementation 'com.google.firebase:firebase-messaging:17.3.3'
        implementation 'com.google.android.gms:play-services-base:16.0.1'
        implementation 'com.android.support:support-v4:28.0.0'
    }
    
    // at the end of the build.gradle file
    apply plugin: 'com.google.gms.google-services'
}

Once you have added dependencies on your build.gradle file, sync your project by clicking on Tools > Android > Sync Project With Gradle Files button.

Step 2: Configure Growlytics credentials in AndroidManifest.xml

To send data to your Growlytics account, you will need to add your Growlytics account's credentials in the AndroidManifest.xml file in your application.

As shown in snippet below, add your Growlytics project id and api key to your AndroidManifest.xml, within the tags.

Step 3: Add required permissions in AndroidManifest.xml

At the root of your manifest file inside <manifest> file, add following permissions.

Step 4: Enable Tracking by Adding Permissions

In your AndroidManifest.xml file, add the following snippet within the tags.

Step 5: Build & Run Your Application

Build and run your application.

Open your Growlytics dashboard. Goto People > Customers. If you successfully integrated the Growlytics SDK, you will see a new customer there.

Step 6: Setup Event Tracking

An Event is an action that user takes in your mobile or web app. Growlytics records the event on the User Profile, using an Event Name and optional associated key:value-based Event Properties. You can then segment users, target and personalize messaging based on both the Event Name and specific Event Properties.

Step 7: User Profile Information

A User is automatically created in Growlytics platrorm when user opens the app first time.

Initially, there are very few properties captured for User Profile like city, country, device info etc. Depending on your product purpose, You can add more information to user profile with Analytics.identify() method.

There are two ways you can do this

  1. If your customer has logged in with your system's user id, then you can pass customer's id which is in your system. This will help you keeping unified profile across web, mobile and other platforms. An example is given below.

  2. Another way, if user has not logged in yet but you still want to keep information as anonymous user, you can do that as well. An example is given below.

Last updated

Was this helpful?