i using admob in app, working fine stopped showing ads @ all. bellow codes used:
mainactivity.xml:
<com.google.android.gms.ads.adview android:id="@+id/adview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_alignparentbottom="true" ads:adsize="banner" ads:adunitid="@string/banner_ad_unit_id"> </com.google.android.gms.ads.adview>
mainactivity.java
adview madview = (adview) findviewbyid(r.id.adview); adrequest adrequest = new adrequest.builder().build(); madview.loadad(adrequest);
androidmanifest:
<uses-sdk android:minsdkversion="9" android:targetsdkversion="19" /> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <!--include adactivity configchanges , theme. --> <activity android:name="com.google.android.gms.ads.adactivity" android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize" android:theme="@android:style/theme.translucent" />
i followed instructions admob site said working few days ago.
bellow few line logcat may related issue:
09-25 22:44:50.292: e/dalvikvm(18554): not find class 'android.app.appopsmanager', referenced method com.google.android.gms.common.googleplayservicesutil.zza
09-25 22:45:07.209: e/ads(18554): js: uncaught referenceerror: renderad not defined (https://googleads.g.doubleclick.net/mads/gma:1) 09-25 22:45:07.209: e/web console(18554): uncaught referenceerror: renderad not defined:1 09-25 22:45:07.209: e/ads(18554): js: uncaught referenceerror: onload not defined (https://googleads.g.doubleclick.net/mads/gma:1) 09-25 22:45:07.209: e/web console(18554): uncaught referenceerror: onload not defined:1
i bellow warning repeatedly , appears more when click blank area ad should showing
09-25 22:46:10.911: w/picturepilelayercontent(18554): warning: painting picturepile without content!
this filtered logcat "ads"
09-25 23:39:25.948: i/ads(28874): starting ad request. 09-25 23:39:25.948: i/ads(28874): use adrequest.builder.addtestdevice("8fcd71caae776558876aaa9ba964245a") test ads on device. 09-25 23:39:26.919: i/ads(22050): app index not enabled 09-25 23:39:30.432: e/ads(28874): js: uncaught referenceerror: renderad not defined (https://googleads.g.doubleclick.net/mads/gma:1) 09-25 23:39:30.442: e/ads(28874): js: uncaught referenceerror: onload not defined (https://googleads.g.doubleclick.net/mads/gma:1) 09-25 23:39:30.442: i/ads(28874): scheduling ad refresh 60000 milliseconds now. 09-25 23:39:30.472: i/ads(28874): ad finished loading.
i have searched everywhere solution , looked @ similar non of them helped me.
use below lines of code
adview madview = (adview) findviewbyid(r.id.adview); adrequest request = new adrequest.builder() .addtestdevice(adrequest.device_id_emulator) // emulators .addtestdevice("ac98c820a50b4ad8a2106ede96fb87d4") // galaxy nexus test phone .build(); madview.loadad(request );
instead of using this
adrequest adrequest = new adrequest.builder().build();
because line used when application ready publish on google play store.
you can place device's id in place of "ac98c820a50b4ad8a2106ede96fb87d4". code device id:
string android_id = settings.secure.getstring(getcontext().getcontentresolver(), settings.secure.android_id);
please read these carefully:
https://developers.google.com/admob/android/targeting#test_ads
https://developers.google.com/admob/android/quick-start
see this
Comments
Post a Comment