Android Integration

1. Gradle Integration:

Add the repository

maven { url 'https://bitbucket.org/tbdsrl/instal-publisher-sdk-releases/raw/master/' }

Add the dependency to our sdk

compile 'com.instal:instal-advertiser-sdk:1.+'

2. Integration:

In your AndroidManifest.xml, add the following elements to define Instal receveir (in the last line insert your api key as value):

<service
    android:name="com.instal.advertiser.sdk.CampaignService"
    android:exported="false"/>

<receiver
    android:name="com.instal.advertiser.sdk.CampaignReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER"/>
    </intent-filter>
</receiver>
<meta-data android:name="instal_api_key" android:value="{{ api_key|default:"API_KEY" }}" />

3. Multiple sources tracking support:

In case you are using Google Analytics for campaign tracking your AndroidManifest.xml should look like this:

<service android:name="com.google.analytics.tracking.android.CampaignTrackingService"/>
<meta-data android:name="instal_delegate_receiver" android:value="com.google.android.gms.analytics.CampaignTrackingReceiver" />

In your AndroidManifest.xml you need to remove existing CampaignTrackingReceiver receiver element to avoid conflicts, it will be called by instal receiver thanks to instal_delegate_receiver definition.

4. Advertising Id support

You need to add google play services to your project to use Advertising id. Instructions are available at http://developer.android.com/google/play-services/setup.html

Proguard configuration

In case you are using Proguard in you project you must add the following rules to keep Google Play Services classes:

-keep public class * extends android.content.BroadcastReceiver
-keep class com.google.android.gms.common.GooglePlayServicesUtil {
    *;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
    *;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
    *;
}

5. Tracking Events

To track an event you need to call

InstalAnalyticsTracker.getInstance(<context>).trackEvent(String event);

If you want to add numeric value to your event use passing NSNubmer object as value.

InstalAnalyticsTracker.getInstance(<context>).trackEvent(String event, float value);

6. Test

For testing the android integration you have to fire the post installation signal using your adb console:

adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n {{ store_id|default:"com.instal.advertiser.sdk.demo" }}/com.instal.advertiser.sdk.CampaignReceiver --es "referrer" "callback_url=https%3A%2F%2Finstal.com%2Ftrkinst%2F%3Fclkid%3Dsdk-syntetic-test-android-sdk%26utm_source%3Dinstal.com%26appid={{store_id|default:"STORE_ID"}}" --ez "debug" true

Support

For any question do not hesitate to contact

E-Mail: support@instal.com