Banner ad not showing after app store application update - android

Initially, my application was showing ads but recently I have updated my application on play store after which it is not showing banner ads most of the times but Interstitial ads are being shown.
After checking the logcat it shows "Ad failed to load : 3" which normally occurs initially when you release your apps/ads initially.
Below is the code:
AdView adView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/first_banner"></com.google.android.gms.ads.AdView>

The ad request was successful, but no ad was returned due to lack of ad inventory.
There is nothing wrong with your code , the issue is admob doesnt always have Ad to return for your request possible reasons could be
-you have just registered your publisher id as it takes some time to start serving ads
-you have filtered some ads
Kindly refer this doc: https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest#ERROR_CODE_NO_FILL

Related

Is there any special way of implementing admob ads?

I am trying to add admob ads to my app by whenever i try the ads do not show but when i use the test ads it shows. I have also cheked my admob account it has been approved for displaying ads
I have tried using the admob test ads and it shows perfectly
Here is an example of the banner ad
mAdView = (AdView)findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
I expect it to show my ads but it shows only the test ads whenever I replace my ad unit with the test ad unit.
Try to confirm that you have used valid banner ad id, If you still not getting real ad wait sometimes and test in another device. Hope it will work
-----------:Add custom layout:--------------
<!--Admob Banner Ad-->
<RelativeLayout
android:id="#+id/rlAdViewBannerAdmob"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
public AdView ad;
AdRequest adRequest;
//init Ad
ad =new AdView(context);
ad.setAdSize(AdSize.SMART_BANNER);
ad.setAdUnitId(adUnitId);
//Load ad
adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("14C739553C9657EB85559903949D428B") //add test Ids
.build();
//load ad
ad.loadAd(adRequest);
rlAdViewBannerAdmob.addView(ad); // add loaded ad in customview
//do not forget to add *YOUR_ADMOB_APP_ID* in manifest
<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="YOUR_ADMOB_APP_ID"/>
</application>
</manifest>

Admob with firebase, only view ads: Nice job! You're displaying a 320x50 test ad from admob

I add admob for my app as guide:
https://firebase.google.com/docs/admob/android/quick-start
and
https://www.youtube.com/watch?v=OLLLRUPICcc&list=PLOU2XLYxmsIKX0pUJV3uqp6N3NeHwHh0c&index=1&spfreload=5
But admob is only view:
Nice job! You're displaying a 320x50 test ad from admob
It does NOT change other ads. Please help me.
Code as below:
In activity at onCreate:
MobileAds.initialize(this, "ca-app-pub-9518053516260440/6844465750");
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
in xml:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
Acording to the Quickstart
If you haven't created an AdMob account and registered an app yet,
there's no better time than now. If you're just experimenting with the
SDK in a Hello World app, though, you can use this App ID to call the
initialize method: ca-app-pub-3940256099942544~3347511713.
You are using testing appID. To make it work you need to create your own account. Than create application and use your own application ID. This will let you customize what ads should show and it will show actual ads. But for testing you should use this AppID, because you should not click on your own ads.
Fix your appID in xml. But even then it takes some time to actualy start working. It might take about day to start showing real ads.

Admob banner doesn't display in production mode

I am integrating admob in my application, using this tutorial. In debug mode, the Admob test banner ad is showing as expected. However, upon removing .addTestDevice("XXXXXXXXXXXXX") and building a signed APK, the real ad doesn't display. Instead the log displays the following:
07-07 16:10:23.743: I/Ads(20143): Starting ad request.
07-07 16:10:23.743: I/Ads(20143): Use AdRequest.Builder.addTestDevice("B2D638A0Bxxx024D83BE163E0E") to get test ads on this device.
Java Code:
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
// Add a test device to show Test Ads
//.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
//.addTestDevice("B2D638A0BEEXXX4024D83BE163E0E")
.build();
// Load ads into Banner Ads
adView.loadAd(adRequest);
XML layout:
<com.google.android.gms.ads.AdView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:id="#+id/adView"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-96XXXXXXXX83/25383XX455" />
Interstitial ads are also integrated into this app and they're displaying perfectly both in debug- and production mode. Why are banners not displaying in production mode?
Found The Solution:
You must create separate ids for banner and Interstitial.While creating an ad-unit a small tab will be opened,if you select banner then an id representing a banner will be created and same goes for Interstitial.I was using Interstitial ID while creating the banner and as a result banner containing Real ads was not showing up.

Android, admob advert is not displaying

I am trying to implement a banner advert in my Android application. I have used Gradle to download the dependencies, etc.
In my activity where I want the advert to be displayed I have:
<com.google.android.gms.ads.AdView
android:id="#+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="#string/ad_mob_id" />
And ad_mob_id is
ca-app-pub-3940256099942544/6300978111
Which is for test ads, I took that from https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start#step_1_modify_the_main_activity_layout
However when I run the activity nothing is displayed and there are no errors/warnings generated.
Am I missing another step?
AdView mAdView = (AdView) getView().findViewById(R.id.adView); // locate the id the banner view
// if you do not use fragments and you are using it directing the remove the getView();
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest); // load it..that's all and you will see logs on it
i took it from the link you posted, it has all you need.

Admob not working at all:The Google Play services resources were not found.Check your project configuration

I have tried everything, applied every solution I found. Checked googleplayservices many times. Still admob is not working.here I see no need to worry.
Does that mean if I submit my app, admob will work fine after submitting? If not here is my code for admob,how do I fix this?
private AdView adView;
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("My App Ad Unit ID");
// Add the AdView to the view hierarchy. The view will have no size
// until the ad is loaded.
LinearLayout layout = (LinearLayout) findViewById(R.id.adViewLayout);
layout.addView(adView);
// Create an ad request. Check logcat output for the hashed device ID to
// get test ads on a physical device.
AdRequest adRequest = new AdRequest.Builder()
// .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
// .addTestDevice("52EEC3DAD2FA75F22B44407D19072632")
.build();
// Start loading the ad in the background.
adView.loadAd(adRequest);
XML:
<LinearLayout
android:id="#+id/adViewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
</LinearLayout>
This is what the google guys say over it
I keep getting the error 'The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.'
You can safely ignore this message. Your app will still fetch and serve banner ads.
Also this has bee asked several times so just ignore it

Categories

Resources