AppsFlyer SDK Integration in Android
Posted By : Prince Bhardwaj | 10-Apr-2017
To integrate Appsflyer in your project, you have to add following in your app level gradle.build -
repositories { mavenCentral() } dependencies { compile 'com.appsflyer:af-android-sdk:4+@aar' ... .. }
After you are done with your gradle.build dependency, make sure to include following permissions in AndroidManifest.xml -
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Now you have to set an install referral broadcast receiver in your AndroidManifest.xml-
1. If you have to use multiple install referral broadcast receiver in your project, add the following receiver as the first receiver -
<!—The AppsFlyer Install Receiver is first and will broadcast to all receivers placed below it -->
<receiver android:name="com.appsflyer.MultipleInstallBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<!—All other receivers should follow right after -->
2. If you are using single broadcast receiver, add these lines in your application tag in AndroidManifest.xml-
<receiver android:name="com.appsflyer.SingleInstallBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
To start tracking add this line to you application class onCreate function -
AppsFlyerLib.getInstance().startTracking(this.getApplication(),"REPLACE WITH YOUR DEV KEY");
THANKS
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Prince Bhardwaj
Prince Bhardwaj is having Talent as Application Developer, he is an enthusiastic team player in Oodles Technologies.