Prerequisites
Before you start to integrate Vpon SDK, please make sure you already have your own Vpon Publisher Account and get your License Key. Register as a Vpon Publisher if you haven’t own your Publisher Account.
Once you have your own Publisher Account, follow the instruction below to integrate Vpon Android SDK:
- Import SDK to your project
- Import required 3rd-party Library
- Add com.vpadn.widget.VpadnActivity to your AndroidManifest.xml
- Add required Permission to your AndroidManifest.xml
- Initialize SDK in your Application or MainActivity
Import SDK to your project
You can install Vpon SDK throught Gradle.
Add Vpon’s Maven repository in allprojects
section in the project-level build.gradle
file.
allprojects {
repositories {
maven{
url 'https://m.vpon.com/sdk/android/maven'
}
}
}
Add the dependency with a specified version of Vpon SDK in the app-level build.gradle
file.
dependencies {
...
implementation 'com.vpon:vpadnSDK:latest.release'
}
3rd-party Library
Vpon SDK start to import 3rd-party Library - Retrofit from 4.8.0
, please follow the steps below to import Retrofit:
- Import Retrofit manually: Download Retrofit here and import the .jar file to your project.
- Import Retrofit with Maven: Please add the snippet below to your build.gradle in App-level to import Retrofit.
dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.21'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
<!-- Import required Google Play Service -->
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
<!-- Import required dependency if you are using Vpon SDK v5.3.2 and above -->
implementation 'com.google.android.gms:play-services-appset:16.0.0'
}
VpadnActivity
Add com.vpadn.widget.VpadnActivity to your AndroidManifest.xml.
<!-- Please add below script if you're using SDK v5.0.2 or above-->
<activity android:name="com.vpon.ads.VponAdActivity"
android:configChanges="orientation|keyboardHidden|navigation|keyboard|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent"
android:hardwareAccelerated="true"/>
Note: EVERY attribute is required!
Since we started to support Video ads from Vpon SDK 4, we recommend that you can add the scripts below to your Activity which contain ads to accelerate hardward performance.
<activity
android:name="com.vpadn.example.MainActivity"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
android:hardwareAccelerated="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Permission
Add permissions below to your AndroidManifest.xml.
<!-- Required Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- Optional Permissions. Use for optimize ad performance -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
SDK Initialization
In order to enhance SDK performance, please follow the instruction below to initialize SDK
// Initial SDK in Application
public class CustomApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
VponMobileAds.initialize(getBaseContext());
}
}
Proguard Configuration
If you are using Vpon Android SDK v5.0.2 or below version SDK in your app, please add the setting below in your Proguard Config:
-dontwarn c.**
-dontwarn com.vpon.**
-dontwarn vpadn.**
-keep class c.**{ *; }
-keep class com.vpon.** { *; }
-keep class vpon.** { *; }
-keep class com.vpadn.** { *; }
-keep class vpadn.** { *; }
<!-- ----------- require since 4.8.0 --------- -->
-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-dontwarn okhttp3.internal.platform.*
-keepattributes Exceptions
-keepattributes Signature
-dontwarn okio.**
-dontwarn javax.annotation.**
Tips
For more ad types, please refer to: