Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Introduction

This document will guide you through the integration process of the RZLTS SDK.

SDK integration steps
Step 1: Add the SDK JARs to Eclipse project
Step 2: Update manifest file
Step 3: Initialize the SDK
Step 4: Add Message Box View

Step 1: Add the SDK JARs to Eclipse project
Copy all JAR files from the SDK zip to the libs directory of android project.
AppInbox.jar Contains SDK, must include this jar.
android-support-v4.jar If project already has this jar no need to copy this jar.
gcm.jar If project already supports Google Cloud Messaging, no need to
include this jar.

Right click on libs/AppInbox.jar and choose Build Path->Add to Build Path.



Step 2: Update Manifest file
Open AndroidManifest.xml, under the main manifest element, add the following
permissions:

<uses- per mi ssi on andr oi d: name="android.permission.INTERNET" / >
<uses- per mi ssi on andr oi d: name="android.permission.GET_ACCOUNTS" / >
<uses- per mi ssi on andr oi d: name="android.permission.WAKE_LOCK" / >
<per mi ssi on andr oi d: name="com.example.project.permission.C2D_MESSAGE"
andr oi d: pr ot ect i onLevel ="signature" / >
<uses- per mi ssi on andr oi d: name="com.example.project.permission.C2D_MESSAGE"
/ >
<uses- per mi ssi on andr oi d: name="com.google.android.c2dm.permission.RECEIVE"
/ >
<uses- per mi ssi on andr oi d: name="android.permission.ACCESS_NETWORK_STATE" / >
<uses- per mi ssi on andr oi d: name="android.permission.VIBRATE" / >
<uses- per mi ssi on andr oi d: name="android.permission.READ_PHONE_STATE" / >

Within the application element add these 2 new activity elements:
<act i vi t y andr oi d: name="com.rzlts.appinbox.InboxActivity"
andr oi d: t heme="@android:style/Theme.Dialog"
andr oi d: l abel ="@string/app_name"
andr oi d: scr eenOr i ent at i on="portrait">
</ act i vi t y>
<act i vi t y andr oi d: name="com.rzlts.appinbox.SettingActivity"
andr oi d: t heme="@android:style/Theme.Dialog"
andr oi d: scr eenOr i ent at i on="portrait">
</ act i vi t y>

Within the application element also add the below receiver and service:
<r ecei ver andr oi d: name="com.rzlts.appinbox.service.GCMReceiver"
andr oi d: per mi ssi on="com.google.android.c2dm.permission.SEND" >
<i nt ent - f i l t er >
<act i on andr oi d: name="com.google.android.c2dm.intent.RECEIVE" / >
<act i on andr oi d: name="com.google.android.c2dm.intent.REGISTRATION" / >
<cat egor y andr oi d: name="com.example.project" / >
</ i nt ent - f i l t er >
</ r ecei ver >

<ser vi ce andr oi d: name="com.rzlts.appinbox.service.GCMIntentService" / >


Now, go through all of the elements that you have just added and
REPLACE com.example.project with your projects package name.


Step 3: Initialize the SDK
In the OnCr eat e method of main activity, add the following line:

AppI nbox. st ar t I nbox( this, " <RZLTS App I nbox Key>" , " <Pr oj ect Number / GCM
Sender I D >" , " <Devel oper Sub I D 1>" , " <Devel oper Sub I D 2>" , " <Devel oper
Sub I D 3>" , " <Fi r st name of User >" , " <Last name of User >" , " <User s Emai l >" ,
<User s Gender , e. g. Gender . MALE>, <Age of User >) ;

The parameters of AppI nbox. st ar t I nbox are:

Context Activity context
RZLTS App Inbox Key String (obtain this after logging into
https://console.rzlts.com/login)
Project Number / GCM Sender ID String (obtain from Google API Console, see
screenshot: http://dp.rzlts.com/vgSW/4vuo9JIF)
Developer Sub ID 1 String (optional, input null if not in use)
Developer Sub ID 2 String (optional, input null if not in use)
Developer Sub ID 3 String (optional, input null if not in use)
First name String (optional, input null if not in use)
Last name String (optional, input null if not in use)
Email String (optional, input null if not in use)
Gender Gender.MALE, Gender.FEMALE, Gender.BOTH (input Gender.BOTH if
unknown)
Age Integer (input 0 if not in use)

Step 4: Add Message Box View
Create a new object of InboxView Class and add in any layout.

Default:

Icon:
final I nboxVi ew i nbox = new I nboxVi ew( this, I nboxType. ICON) ;
<Any Layout >. addVi ew( i nbox) ;
Text:
final I nboxVi ew i nbox = new I nboxVi ew( this, I nboxType. TEXT) ;
<Any Layout >. addVi ew( i nbox) ;

Custom icon:
final I nboxVi ew i nbox = new I nboxVi ew( this , I nboxType. ICON)
{
@Over r i de
public Dr awabl e get I nboxI con( )
{
// Return any image drawable
}
};
<Any Layout >. addVi ew( i nbox) ;

Custom text:
final I nboxVi ew i nbox = new I nboxVi ew( this , I nboxType. TEXT)
{
@Over r i de
public St r i ng get I nboxText ( )
{
// Return text you want display, e.g. Inbox, My Inbox
}
};
<Any Layout >. addVi ew( i nbox) ;

Sample Code:

RelativeLayout rlLayout = (RelativeLayout) this.findViewById(R.id.rlLayout);

final I nboxVi ew i nbox = new I nboxVi ew( this) ;
rlLayout. addVi ew( i nbox) ;

Step 5 (Optional): Add Data Points
A Data Point is any end user in-app action that you want to record. These are important to help
evaluate the User Quality Scores for your app. Create Data Points from the RZLTS Console and
select/copy the Data Point Id.

The additional arguments (Details 1 through Details 5) are optional for you to use and review on the
Reports section of the RZLTS console. These are handy for values like your users ID, item price, item
sku code, etc.

You can place a Data Point call anywhere within your app to track an event, to do so put following line
of code:

AppI nbox. setDatapoint( this, " <Dat a Poi nt I D>" , " <Det ai l 1>" , " <Det ai l 2>" ,
" <Det ai l 3>" , " <Det ai l 4>" , " <Det ai l 5>" ) ;

The parameters of AppI nbox. setDatapoint are:

Context Activity context
Data Point ID String
Details 1 String (Optional)
Details 2 String (Optional)
Details 3 String (Optional)
Details 4 String (Optional)
Details 5 String (Optional)


Step 6 (Optional): Callback URL for Attribution Tracking
You can optionally use the following Callback URL to attribute where a new install/user originated
from, for example if you were advertising you can record the advertising network name as well as the
promotion method used.

https://console.rzlts.com/pb?did=&aid=&idfa=&mac=&openidfa=&from=&type=&key=

Available Parameters
did : Device ID / Android (The IMEI for GSM and the MEID or ESN for CDMA phones)
aid : Android ID
(http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
idfa : iOS Identifier for Advertisers
mac : MAC address
openidfa : for iOS apps without in-app ads, an alternative to idfa (read more about openIDFA at
https://github.com/ylechelle/OpenIDFA
from : This is the ad network name or your traffic source
type : This is the type of promotion use for the traffic, for example CPC (cost per click), CPI (cost per
install
key : This is your apps RZLTS app inbox key (Required)

Not all parameters are required but at least 1 device identifier is so that we can attribute the new
install correctly. So for Android, we need either the 'Device ID' value or the 'Android ID' value.
For iOS we need either the IDFA value, MAC address value or openIDFA value.

If you need assistance setting this up with your third party tracking provider or within your own in-
house tracking system please contact us at support@rzlts.com or call 1-888-311-2356.

You might also like