android - AdView shows only test banner on emulator -
i've created account on admobs, created banner test.
the code bannerexample, without addtestdevice(...)
public class myactivity extends actionbaractivity { private adview madview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_my); // gets ad view defined in layout/ad_fragment.xml ad unit id set in // values/strings.xml. madview = (adview) findviewbyid(r.id.ad_view); // create ad request. check logcat output hashed device id // test ads on physical device. e.g. // "use adrequest.builder.addtestdevice("abcdef012345") test ads on device." adrequest adrequest = new adrequest.builder() .build(); // start loading ad in background. madview.loadad(adrequest); }
activity_my.xml
<com.google.android.gms.ads.adview android:id="@+id/ad_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_alignparentbottom="true" ads:adsize="banner" ads:adunitid="ca-app-pub-6784520601040456/7994286128" />
but see test banner, when launch application.
should specify else, see real banner?
try check out in real device. add doesnt show in emulator.
Comments
Post a Comment