简体   繁体   中英

Adsense Ads not displaying in android

I am implementing Adsense in my application. I have the publisher id and I have implemented the code in my application using Google Adsense SDK tutorial. But Ads are not displaying in my application.

Here is my code :

AdSenseSpec adSenseSpec = new AdSenseSpec("pub-xxxxxxxxxxxxxxxx") .setCompanyName("company name while registering in google Adsense") .setAppName("Application name")
.setAdTestEnabled(false);

  GoogleAdView adView = (GoogleAdView) findViewById(R.id.adview);
       adView.setEnabled(true);
       adView.showAds(adSenseSpec);

These is getting in logcat :

05-18 13:19:41.077: WARN/webcore(8506): Can't get the viewWidth after the first layout 05-18 13:19:43.377: VERBOSE/NotificationService(171): [cancelNotificationWithTag]::::: pkg:android id:-669611123 05-18 13:19:43.859: WARN/PowerManagerService(171): Timer 0x3->0x3|0x0 05-18 13:19:44.297: WARN/webcore(8506): Can't get the viewWidth after the first layout

Can any body have any clue?

Thanks & Regards

Try initializing it like this(this is for the newer version)

AdView mAdView = (AdView) findViewById(R.id.adView); 
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM