Our Android SDK is shipped as an Android library (AAR) which you need to add as a dependency to your Gradle file.
How to include itSection titled How to include it
For distribution of our API we use Maven Central Repository which is supported by the Android build system by default. To add our SDK (or library), add the following line to your application’s dependency list.
Start the SDKSection titled Start the SDK
You do not need to do anything to start the SDK. Now that the SDK is a dependency of your app, it will autostart itself when your application starts.
Disabling Automatic SDK InitializationSection titled Disabling Automatic SDK Initialization
com.contentsquare.android.autostart flag to false in your
Then, you can start the Contentsquare SDK by calling the
start() method of the Contentsquare class.
This initialize function is called automatically on app startup if the
com.contentsquare.android.autostart flag is not listed in the AndroidManifest.
This function should be called before the first activity is created. Call this function in the
onCreate() method of a custom Application subclass:
Validate SDK integrationSection titled Validate SDK integration
Start your application, you should see the SDK print a log like this one:
If the SDK does not seem to work, it might mean that your app’s package name is not tied to any Contentsquare project. In that case, you will have to communicate all variants of your app’s identifier to your Contentsquare contact to be added as a project.
Now that the SDK runs in your app, you will want to implement calls to our SDK to track screenviews, transactions, and more. Keep following along this guide to know how.
Sample AppSection titled Sample App
For best implementation practices of our library, explore the Contentsquare for Android sample app.
Use TealiumSection titled Use Tealium
Our partner Tealium has developed a remote command module to integrate with the Contentsquare SDK. This solution leverages the convenience of iQ Tag Management to configure a native Contentsquare implementation without having to add Contentsquare-specific code to your app.
Follow instructions on Tealium’s documentation: Remote Command for Contentsquare.