//Granify Android SDK

Granify Android SDK

[androidJvm]\

Details

This project houses an Android library intended to be utilized within Android applications to make it easy to communicate with Granify’s servers and to show messages to shoppers.

Android versions 5 (Lollipop, API level 21) and greater are supported.

Project Organization

The Granify class is the main interface for functions to be called by your application. For details, please see the documentation provided for each of these methods, as well as the quick start guide below for an overview of how each function fits into the API as a whole. Note that each package listed at the bottom of this page provides a more detailed explanation of the API’s components.

Installation Quick Start

1. Include the Granify Library in your Android Studio Project

Include the path to the unzipped GranifyAndroidSDK local maven repository in the allprojects section of your project level build.gradle file.

allprojects {
    repositories {
        maven {
            url "<path to GranifyAndroidSDK folder>"
        }
        ...
    }
}

In the app level build.gradle file add implementation 'com.granifyinc:granifysdk:<current_version>' to the dependencies section. The current version number of the SDK is the same as the name of the folder located at GranifyAndroidSDK/com/granifyinc/granifysdk.

dependencies {
    ...
    implementation 'com.granifyinc:granifysdk:<current_version>'
    ...
}

2. Register Granify event handlers

2.1 Event notification handlers

The following API methods allow handlers to be registered for events generated by this SDK:

Register these handlers before activating Granify to ensure that no events are missed. These handlers are a useful place to track Granify events with your analytics system.

2.2 (Optional) Group assignment provider

In most cases Granify assigns matching groups for each session. However, if this is not the case for your site (ask your Account Manager if you are unsure), then you will need to register a group provider that will dictate the MatchingGroup to be used for each session. Register this provider via registerGroupAssignmentProvider.

3. Initialize the Granify SDK

3.1 Activate the Granify SDK

In order to start communications with Granify’s servers, the SDK must first be activated by calling activateGranify. This provides the necessary configuration parameters and initiates a session. Note that this call and any subsequent API call will all be processed on a background thread.

3.2 (Optional) Set the shopper’s unique identifier

After activating Granify, setShopperId may be called optionally to provide Granify with a persistent shopper identifier to use for the session. It may be called later in the session if the shopper is not identified until further action takes place (like signing in to their account).

4. Track the shopper’s session with Granify

As the shopper uses your application, Granify will need to be made aware of many aspects of their shopping session to be effective. The following functions should be called accordingly:

5. Prepare for testing

Granify will work with your team to create messages that fit your application’s styling and best practices.

To enable easy testing and previewing of specific messages, a trusted user should be able to supply a string (often via a hidden administrator or developer tooling section of the application) that is forwarded along to showCampaign.

Packages

Name  
com.granifyinc.granifysdk Contains Granify, the entry point for all Granify SDK API methods.
com.granifyinc.granifysdk.campaigns.inlineView  
com.granifyinc.granifysdk.config Contains classes used for configuring the Granify SDK.
com.granifyinc.granifysdk.helpers  
com.granifyinc.granifysdk.logging  
com.granifyinc.granifysdk.models Contains classes to be used when integrating with the Granify SDK.