java - How to create android Ad Interstitials? -
i dont interstitialad , coudnt find example.if have example, can post .i try banner works . when try interstitialad error.i want when open app wanna see ads .
thanks!!
package com.example.reklam3; import android.app.activity; import com.google.ads.*; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; import com.google.ads.ad; import com.google.ads.adlistener; import com.google.ads.adrequest; import com.google.ads.adrequest.errorcode; import com.google.ads.interstitialad; public class mainactivity extends activity implements adlistener{ private interstitialad interstitial; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // create interstitial interstitial = new interstitialad(this,"ca-app-pub-90707885707358xx"); // create ad request adrequest adrequest = new adrequest(); // begin loading interstitial interstitial.loadad(adrequest); // set ad listener use callbacks below interstitial.show(); } @override public void onreceivead(ad ad) { log.d("ok", "received ad"); if (ad == interstitial) { interstitial.show(); } } @override public void ondismissscreen(ad arg0) { // todo auto-generated method stub } @override public void onfailedtoreceivead(ad arg0, errorcode arg1) { // todo auto-generated method stub } @override public void onleaveapplication(ad arg0) { // todo auto-generated method stub } @override public void onpresentscreen(ad arg0) { // todo auto-generated method stub } }
if have sipmle examle can post .ty
i posted answer question here:
https://stackoverflow.com/a/24150614/1287856
basically, need to:
- call
adrequest.build()
before// begin loading interstitial
Comments
Post a Comment