Android admob works with new app, but I cant seem to implement ads into a finished app -
i have followed https://developers.google.com/admob/android/quick-start , made banner ad show fine when go finished app try , change exact same pieces of code doesn't want show up. i'm interested know if has encountered or can think of missing. relevant logcat when test finished app code changed:
06-25 19:43:42.419 7054-7054/com.testing.testapp i/ads﹕ starting ad request.
06-25 19:43:44.391 7054-7054/com.testing.testapp i/ads﹕ scheduling ad refresh 60000 milliseconds now.
06-25 19:43:44.421 7054-7054/com.testing.testapp i/ads﹕ ad finished loading.
import com.google.android.gms.ads.adrequest; import com.google.android.gms.ads.adsize; import com.google.android.gms.ads.adview; public class homeactivity extends activity { private relativelayout bannercontainerlayouthome; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); bannercontainerlayouthome = (relativelayout)findviewbyid(r.id.bannercontainerlayouthome); showbannerad(); } /** * show ad banner @ footer * */ private void showbannerad() { adview adview = new adview(homeactivity.this); //cal method show banner add adview.setadsize(adsize.smart_banner); adview.setadunitid("put_your_ad_unit_id"); bannercontainerlayouthome.addview(adview); adrequest adrequest = new adrequest.builder().addtestdevice(secure.getstring(getcontentresolver(),secur e.android_id)).build(); adview.loadad(adrequest); } }
Comments
Post a Comment