For Android Version 4.8.7
The Android sample app was developed using Android Studio environment.
AppsFlyer’s Sample App enables you to see how our newest SDK is integrated into a working project.
You can use this project as a reference to your own project to verify and debug the integration process. In addition, you can use the sample app to run end-to-end test scenarios and review the results in your dashboard, such as reports and Push API.
For your convenience, the project contains instructions in the comments under the tag: AppsFlyer.
Using the Sample App for Testing
The following sections are covered in this guide:
- Using the Sample App
- Customizing your Sample App
- Deep Linking
You can use this project to test the functionality of the SDK and view changes made in your AppsFlyer dashboard.
Follow these instructions to link the project to your AppsFlyer account:
- Open the project using Android Studio
- Change the package name to match the name configured in your AppsFlyer dashboard (your new package name must be unique). Make sure your new package name appears in all references throughout the project (Make sure the same name appears in build.gradle).
- Under the Java directory, open the Java file MainActivity.java.
You can find the method located in onCreate
Replace your_dev_key with the one enlisted under the SDK Integration section of your AppsFlyer dashboard.
4. Build the App to your test device. Make sure your test device is whitelisted in your AppsFlyer dashboard - refer to this article for more information.
Now you can test the sample app on your device, and see the changes in your dashboard!
Make sure to use a custom generated AppsFlyer link before installing the app on your device, to receive a non-organic Install.
Using the Sample App
Once you have configured the project to be associated with your AppsFlyer account, you can open it and the following screen is displayed:
- Attribution Values: Shows the the core values of your installation - You can see if you received a non-organic install after clicking a custom link, as well as your media source, click time (on your link) and install time (on your device).
- Track Event: Click this button to launch an event tracking call which you can view in your dashboard (See Deep Linking below for details of customization of this button).
Customizing Your Sample App
The sample app project contains a button to trigger a custom event tracking call.
By default, this button is set to track a purchase event which can then be viewed in your dashboard as a revenue increase of $200.
If you wish to test additional events, you can find the code for this tracking in the MainActivity.java file, under the buttonOnClick method.
To review all available event types which you can track with AppsFlyer’s SDK, refer to this article.
In addition, under the registerConversionListener method, you can find several attribution parameters which are shown in a TextView. To view all available parameters, refer to this article.
For unpublished apps and parameters other than the ones which are printed in the default code of the sample app, are returned as Null.
To edit your deep linking scheme:
1. Go to the AndroidManifest file.
2. Edit the <data> tags under <intent-filter>, inside Deep link <activity>.
3. Generate a custom media source link using AppsFlyer’s dashboard. Refer to this article for guidance. Make sure to include "&advertising_id=YOUR_
4. Add the following tags to your link
- Using only a scheme
- Using a scheme and a host
In your AndroidManifest file you can view your custom deep links’ schemes and hosts and change them as required. They are located under the <intent-filter> tab inside the Deep Link <activity> tab.
By default, you can test the deep linking in the sample app using the following links:
- For http://aftest.com
- For aftest://
Ensure the app is installed on your device before testing the deep links, as unpublished apps are not redirected to Google Play in case they are not pre-installed.
Click one of the deep links and you are redirected to the Deep Link Activity, which cannot be accessed in any other way -
You can also view the link you navigated from into the activity.
By using the
sendDeepLinkData method in the Deeplink.java file (located in
onCreate), you can attribute the deep linking to the corresponding media source.