Integration

A comprehensive guide to integrating your android app with InviteReferrals. The new SDK for android helps you to run a referral campaign in InviteReferrals. Read this guide to know the basic integration of the referral campaign, how to track the events, how to show a welcome message, and other important information via FAQs.

Read this guide to integrate your android app with InviteReferrals android SDK.

Follow the below steps :

  1. Add the following repository to your project-level build.gradle file:
repositories {
        google()
        mavenCentral()
    }
  1. Add the following dependency to your build.gradle file of your app.
dependencies {
               implementation 'com.android.installreferrer:installreferrer:1.1.1'
               implementation 'com.invitereferrals.invitereferrals:invitereferrals:v1.0.12'
              }

Configure your AndroidManifest.xml

<manifest….>
      ​<uses-permission​ ​android:name="android.permission.ACCESS_NETWORK_STATE"/> 
      ​<uses-permission​ ​android:name="android.permission.ACCESS_WIFI_STATE"​ ​/>
      ​<uses-permission​ ​android:name="android.permission.INTERNET"/>  
      ​<application....> ​ ​​ ​​ ​​
      ​​ ​​ ​​ ​​ ​<meta-data​ ​android:name="invitereferrals_bid"​ ​android:value="17xx"​ ​></meta-data> ​ ​​
      ​​ ​​ ​​ ​​ ​​ ​​ ​<meta-data​ ​android:name="invitereferrals_bid_e"​ ​android:value="B0xxxxxxx"​ ​></meta-data>

📘

Note: In above example Dummy Brand ID and Encryption keys shown. Kindly login your IR_account to see your credentials.

If you want to use contact sync feature, then add the following permissions into your apps AndroidManifest.xml under manifest tag.

<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />

Initializing the SDK

a)​ ​​​ ​If​ ​you​ ​don’t​ ​have​ ​your​ ​own​ ​application​ ​class,​ ​then​​ ​register​() ​our​ ​application​ ​class​ in manifest file ​as follows​ :

<application android:name​="com.invitereferrals.invitereferrals.InviteReferralsApplication"></application>

OR

b)​​ ​​ ​If​ ​you​ ​have​ ​your​ ​own​ ​application​ ​class,​ ​then​ call​ ​our register​ ​method​ inside​ ​your​ ​application​ ​class​ ​onCreate​() ​method,​ as follows :

​​InviteReferralsApplication.register(this);