Android - Interstitial Ad
Compatible with Vpon SDK v4.9 and below
Compatible with Vpon SDK v4.9 and below
Interstitials, on the other hand, immediately present rich HTML5 experiences or “web apps” at natural app transition points such as launch, video pre-roll or game level load. Web apps are in-app browsing experiences with a simple close button rather than any navigation bar—the content provides its own internal navigation scheme. Interstitial ads are typically more expensive and subject to impression constraints.
Note: We suggest that you should put the interstitial ads in the portrait mode for the best visual performance.
Please make sure you’ve imported Vpon SDK to your Xcode project. If not, please refer to our Integration Guide to finish your setting.
The richer, more heavyweight nature of Vpadn interstitial is reflected by its definition not as a UIView but rather an NSObject requiring more distinct instantiation, load and display steps.
Usage is nevertheless very similar to Vpadn banner:
com.vpadn.ads.*
VpadnInterstitialAd
instanceWe strongly recommend that you can finish all the steps in the Activity of the application.
import com.vpadn.ads.*;
public class MainActivity extends Activity implements VpadnAdListener {
// Declare VpadnInterstitialAd instance
private VpadnInterstitialAd interstitialAd;
// Please fill in with your License Key
private String interstitialBannerId = "License Key";
...
}
public class MainActivity extends Activity implements VpadnAdListener {
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create VpadnInterstitialAd instance
interstitialAd = new VpadnInterstitialAd(this, interstitialBannerId, "TW");
interstitialAd.setAdListener(this);
VpadnAdRequest request = new VpadnAdRequest();
// Start to load Interstitial Ad
interstitialAd.loadAd(request);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (interstitialAd != null) {
interstitialAd.destroy();
interstitialAd = null;
}
}
You can only show Interstitial Ad after the ad request success.
Please avoid to show Interstitial Ad right away after ad request. We recommend that you can request Interstitial Ad first and show it in a specific moment. For example, you can implment VpadnAdListener and show ad when onVpadnReceiveAd be triggered.
public class MainActivity extends Activity implements VpadnAdListener {
...
@Override
public void onVpadnReceiveAd(VpadnAd ad) {
if (ad == this.interstitialAd) {
// Show Interstitial Ad
interstitialAd.show();
}
}
...
}
Please add the code snippet to your application and fill in with your test device’s UUID as below to request for test ads.
public class MainActivity extends Activity implements VpadnAdListener {
...
VpadnAdRequest adRequest = new VpadnAdRequest();
HashSet<String> testDeviceImeiSet = new HashSet<String>();
// Add Android device advertising id
testDeviceImeiSet.add("your device advertising id");
adRequest.setTestDevices(testDeviceImeiSet);
vponBanner.loadAd(adRequest);
...
}
Here are some tips for you to get your advertising id:
public class MainActivity extends Activity implements VpadnAdListener {
@Override
public void onVpadnReceiveAd(VpadnAd ad){
Log.d("Banner", "VpadnReceiveAd");
}
@Override
public void onVpadnFailedToReceiveAd(VpadnAd ad, VpadnAdRequest.VpadnErrorCode errCode){
Log.d("Banner", "fail to receive ad (" + errCode + ")");
}
@Override
public void onVpadnPresentScreen(VpadnAd ad){
Log.d("Banner", "VpadnPresentScreen");
}
@Override
public void onVpadnDismissScreen(VpadnAd ad){
Log.d("Banner", "vpadnDismissScreen");
}
@Override
public void onVpadnLeaveApplication(VpadnAd ad){
Log.d("Banner", "VpadnLeaveApplication");
}
}
We recommend that you can get Interstitial Ad first and show it after a specific event happened instead of load ad and show it immediately.
Please follow our Integration Guide to add VpadnActivity in your AndroidManifest.xml. If you didn’t add android:configChanges=“orientation|screenSize”
in VpadnActivity, please avoid to loadAd() and show Interstitial Ad in onCreate section.
Please refer to our Sample Code for a complete integration sample.
Please refer to the link below to learn more about other ad types: