Android SDK
Important: Minimum supported system WebView version for surveys is 51.0.2704.90, it is default for Android 7.0.
LATEST Android SDK Version: 1.0.20
#
SetupIntegration is easiest with gradle dependency. In order to do that you need to add two pieces of code to your project. First goes into root build.gradle file. You need to add jitpack.io repository into list of repositories for all projects like this:
After that you just need to add the actual SDK dependency into build.gradle of the app module:
After re-syncing the project from gradle files you will be able to start using inBrain SDK.
#
ConfigurationInBrain SDK configuration can be completed at app launch or before SDK usage. Follow the steps below as our recommendation for properly configuring the InBrain SDK before use:
1.) Use the following to pass your API keys and a unique User_Id. See our Getting Started guide to generating your ClientId and Secret Key. Also note that by default you should pass true for isS2S
by default.
2.) To subscribe to events, add the following. Event callbacks are covered more in detail here.
3.) Customize the UI. Below is example code and more detail on UI customization is discussed here
#
UsageinBrain offers two methods of displaying surveys to your users. The simplest method is use of the inBrain Survey Wall, which presents the inBrain experience with no additional work required. See the this section
A second method is use of the inBrain Native Surveys, which acts as an API to fetch surveys and leaves the display of those surveys up to you. It's explained in detail here
#
Survey WallIn order to open inBrain survey wall, execute the following call:
This will open the survey wall in new activity. inBrain SDK will handle everything else. It will return control to last opened activity of your app after user leaves the survey wall. More on receiveing those events detailed here
#
Native surveysNative Surveys act as a simple API via the SDK to fetch and display surveys.
1.) Use the following to fetch surveys:
3) Next you will display the surveys from step #1 within your app. When the user selects one of these surveys, use the following function to display the survey:
#
Custom Tracking Data & Demographic DataThe inBrain SDK provides an additional function setInBrainValuesFor()
which allows you to do two things:
1.) Provide demographic data to provide an even more seamless on-boarding of your users into the inBrain experience. You can pass gender
and age
with the following
2.) Provide tracking data that can be used internally within your system. The tracking data you supply as SessionId
will be provided in the Server to Server Callback inBrain sends to your server.
Please, note: The above configuration should be done before showing the surveys, or it will have no effect.
#
CallbacksIn app callbacks are delegate functions that are executed upon specific events and allow you to intercept those events. Below is an example of setting up event callbacks:
If you added a callback in onCreate
, you should remove you callback in onDestroy
method of an activity like this:
Don't forget to remove the callbacks, otherwise it can cause a memory leak!
#
Check For Rewards in AppThe typical inBrain integration flow is that your app would receive reward events to your server via Server-to-Server callbacks as opposed to checking for earned rewards within the app experience. In the case that you DO want to check for rewards earned during the inBrain experience, you can utilize the following:
*Note: We highly recommend using Server-to-Server Callbacks for receiving and processing rewards.
#
Custom UI Configuration1. Toolbar:
Set toolbar color:
Also you may pass color's resource id:
Title:
If you want to leave toolbar's text empty, just pass empty String
to it.
Title text's color:
Also you may pass color's resource id:
Back icon's color:
Also you may pass color's resource id:
If you want to enable elevation for toolbar, use:
Finally, set toolBarConfig
to inBrain:
2. Status bar:
Set status bar color:
Also you may pass color's resource id:
By default, status bar icons' color will be white. If you need to use black status bar icons:
#
Supported Country Language ListBy default, the device locale language will be used. This controls which language the inBrain experience will be presented with as well as surveys for that specific country/language locale
Accepted languages: "de-de"
, "en-au"
, "en-ca"
, "en-gb"
, "en-in"
, "en-us"
, "es-es"
, "es-mx"
, "es-us"
, "fr-ca"
, fr-fr"
, "fr-br"
#
Check if Surveys AvailableThe inBrain SDK provides functionality to check if surveys are available for a user. You check for surveys available after the initial inBrain configuration.