Use this guide to monetize an Android or Amazon app with Liftoff. Integrating the Vungle SDK into your app is the first step toward displaying ads and earning revenue. Once you've integrated the SDK as instructed in this article, you can proceed to implement one or more of the supported ad formats.
Requirements
- Android Studio Electric Eel or higher
- Android Gradle Plugin(AGP) v.7.4.2 or lower
- This SDK targets devices running:
- Android 7.1 or higher
- Amazon OS 6 or higher
- Recommended: Create a Liftoff account and register an app
Step 1. Add the SDK
You can add the Vungle SDK either through Maven Central (recommended) or manually.
Option 1. Maven Central (Recommended)
The Vungle SDK is available through Maven Central. Add the following into your project’s Gradle file:
implementation 'com.vungle:vungle-ads:7.4.0'
Option 2. Integrate Manually
Download the latest version of the Vungle SDK for Android/Amazon and link all the following dependencies in your project:
implementation files('libs/vungle-7.4.0.aar')
implementation files('libs/core-ktx-1.9.0.jar') implementation files('libs/kotlinx-serialization-json-jvm-1.4.1.jar') implementation files('libs/kotlinx-serialization-core-jvm-1.4.1.jar') implementation files('libs/okhttp-4.10.0.jar') implementation files('libs/okio-jvm-3.0.0.jar') implementation files('libs/protobuf-javalite-3.21.12.jar')
Step 2. Initialize the SDK
After you have successfully installed the SDK, you must initialize it.
- Open your project file.
- Add the following code snippet in your app:
VungleAds.init(requireContext(), APP_ID, object : InitializationListener { override fun onSuccess() { Log.d(TAG, "Vungle SDK init onSuccess()") } override fun onError(vungleError: VungleError) { Log.d(TAG, "onError(): ${vungleError.localizedMessage}") } })
VungleAds.init(requireContext(), APP_ID, new InitializationListener() { @Override public void onSuccess() { Log.d(TAG, "Vungle SDK init onSuccess()"); } @Override public void onError(@NonNull VungleError vungleError) { Log.d(TAG, "onError():" + vungleError.getErrorMessage()); } });
Step 3. Integrate Ad Formats
Complete the SDK integration for each ad format you plan to display in your app. Refer to our instructions for each ad format:
- Integrate Interstitial Ads
- Integrate Rewarded Ads
- Integrate Banner Ads
- Integrate Native Ads
- Integrate App Open Ads
Step 4. Further Customize Your Ads
Follow the instructions in our Advanced Settings article to fine-tune your app's integration with additional configuration options, such as GDPR, CCPA implementation, and other settings.