android - AdMob No Live-Ads appearing -
i have made application android studio, , have finished app. added adview application, , used testad-unitid, , got test ads. on emulator , on mobile phone. worked, , had test ads running. created admob account, , added app in there, created bannner ad, had in application, , used adunitid, admob page. when ran application on phone got no ads @ all. in case matters: app isn't on play store.
i read have wait several hours, until live-ads, have been waiting on 12h, , im still not getting ads on phone.
if need it, here code:
my adview:
<com.google.android.gms.ads.adview android:id="@+id/adview" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintbottom_tobottomof="parent" ads:adsize="banner" ads:adunitid="@string/banner_ad_unit_id" android:layout_marginbottom="16dp" android:layout_marginleft="8dp" app:layout_constraintleft_toleftof="parent" android:layout_marginright="8dp" app:layout_constraintright_torightof="parent" />
my oncreate method:
mobileads.initialize(getapplicationcontext(), "ca-app-pub-hiddenhiddenhide~hiddenhide"); adview ad = (adview) findviewbyid(r.id.adview); adrequest request = new adrequest.builder().build(); ad.loadad(request);
you need add line builder.
.addtestdevice(adrequest.device_id_emulator)
so need have this:
adrequest request = new adrequest.builder() .addtestdevice(adrequest.device_id_emulator) .build();
if want use own mobile phone. can id in logcat needs added this:
adrequest request = new adrequest.builder() .addtestdevice("here goes id of phone") .build();
the reason why need because when developing can't see adds because app not placed in playstore. long isn't in playstore won't see ads. can create test-ads code provided
if go production try using code: (it wil use testdevice debugging , developing use real adds device when in production )
adrequest adrequest = new adrequest.builder() .build(); if (buildconfig.debug) adrequest = new adrequest.builder() .addtestdevice(adrequest.device_id_emulator) .addtestdevice("your id goes here") .build();
Comments
Post a Comment