Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AdMob using Google Play Services - Test ads - No fill from ad server

Good morning,

My issue is that ads are not being displayed at all in my app, test mode or not. I am going to keep this question specific to test mode, and once I get that working I will worry about live ads.

Development Information

I am using Eclipse for development.

I have setup ads using Google Play Services and Admob in my Android app, as described in the online documentation provided by Google.

I have added my device ID using addTestDevice("xxxxxxxxxxxxxxxx"), and have checked the hashed device ID a number of times to be sure it is correct.

I am using a real device for testing. HTC Sensation with Android 4.1.2. Ads run fine for other apps installed on the device.

The Issue (see below for log info)

When I run the application on my device, no ads are displayed at all. This happens even when I have added my device as a test device.

I have searched high and low, and turned up many similar issues, but am yet to find an answer to this specific problem.

I have tried numerous things:

  • Running in an emulator (issues here running newer versions of Android on my old slow laptop). Same problem.
  • Rewriting the whole of the ad code from scratch.
  • Reimporting Google Play Services.
  • Reinstalling eclipse - now using the latest Android Developer Tools.
  • Downloading Google Play Services and importing the project again.
  • Cleaning my project several times.
  • Googling, Googling and more Googling.

I simply cannot get to the bottom of this issue. I will be most grateful to anyone who can help me out here. I have a feeling I may be missing something very small yet important out that is causing me these issues.

The lines I am concernet about I have placed in the filtered log below ('no fill from ad server'). In the full log, there is also a line 'the google play services resources were not found', but after some research this seems not to be the cause of my problems, and looks to be something we can ignore.

Anyway, I think that's about all the info I have - thank you in advance to anyone who looks into this for me.

Filtered Logs

LogCat outputs the following, when filtered by 'log:ads':

03-15 09:51:46.549: I/Ads(12405): Use AdRequest.Builder.addTestDevice("A24031FACA2D8B7F7AFB280EB4E87A11") to get test ads on this device.
03-15 09:51:46.569: I/Ads(12405): Starting ad request.
03-15 09:51:48.642: I/Ads(12405): No fill from ad server.
03-15 09:51:48.652: W/Ads(12405): Failed to load ad: 3

Full logcat output

03-15 10:07:56.980: D/IntroActivity(15242): ++onCreate
03-15 10:07:59.432: I/Ads(15242): Use AdRequest.Builder.addTestDevice("A24031FACA2D8B7F7AFB280EB4E87A11") to get test ads on this device.
03-15 10:07:59.442: I/Ads(15242): Starting ad request.
03-15 10:07:59.572: D/webcoreglue(15242): netstack: Memory Cache feature is ON
03-15 10:07:59.953: W/(15242): init htc webcore
03-15 10:08:00.013: E/GooglePlayServicesUtil(15242): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-15 10:08:00.123: I/KENLOG(15242): setSpellCheckEnabled <enabled: false> delay: 1000
03-15 10:08:00.143: I/KENLOG(15242): setSpellCheckEnabled <enabled: true> delay: 1000
03-15 10:08:00.233: I/Adreno200-EGL(15242): <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_RB1.04.01.01.06.043_msm8660_surf_JB_REL_RB1.2_CL2428086_release_AU (CL2428086)
03-15 10:08:00.233: I/Adreno200-EGL(15242): Build Date: 11/15/12 Thu
03-15 10:08:00.233: I/Adreno200-EGL(15242): Local Branch: 
03-15 10:08:00.233: I/Adreno200-EGL(15242): Remote Branch: m/jb_rel_rb1.2
03-15 10:08:00.233: I/Adreno200-EGL(15242): Local Patches: NONE
03-15 10:08:00.233: I/Adreno200-EGL(15242): Reconstruct Branch: AU_LINUX_ANDROID_JB_REL_RB1.04.01.01.06.043 + e534df6 + 951c251 + 07bf631 + 6aa3ec7 + e04e486 + 9f5646a + 855d11b +  NOTHING
03-15 10:08:00.333: D/memalloc(15242): ion: Mapped buffer base:0x5a4a0000 size:2088960 offset:0 fd:86
03-15 10:08:00.333: D/memalloc(15242): ion: Mapped buffer base:0x564cd000 size:4096 offset:0 fd:88
03-15 10:08:00.353: E/GooglePlayServicesUtil(15242): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-15 10:08:00.433: D/memalloc(15242): ion: Mapped buffer base:0x5b4ed000 size:2088960 offset:0 fd:93
03-15 10:08:00.433: D/memalloc(15242): ion: Mapped buffer base:0x56787000 size:4096 offset:0 fd:95
03-15 10:08:00.433: D/HostStatisticManager(15242): netstack: DNS Host Prioritization is: ON, Version: 5.0.1
03-15 10:08:00.433: I/(15242): netstack: LIB_MGR - Lib loaded: libdnshostprio.so
03-15 10:08:00.433: E/(15242): netstack: STAT_HUB - Processor name is undefined
03-15 10:08:00.433: E/(15242): netstack: STAT_HUB - Failed to load plugin: libdnshostprio.so
03-15 10:08:00.433: E/(15242): netstack: LIB_MGR - Error loading lib spl_proc_plugin.so
03-15 10:08:00.433: E/(15242): netstack: STAT_HUB - Failed to load plugin: spl_proc_plugin.so
03-15 10:08:00.443: W/dalvikvm(15242): [GC Control] disableGcForExternalAlloc: false
03-15 10:08:00.453: E/(15242): netstack: LIB_MGR - Error loading lib pp_proc_plugin.so
03-15 10:08:00.453: E/(15242): netstack: STAT_HUB - Failed to load plugin: pp_proc_plugin.so
03-15 10:08:00.453: E/(15242): netstack:  STAT_HUB - App quizHarness.quiz isn't supported
03-15 10:08:00.493: E/GooglePlayServicesUtil(15242): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-15 10:08:00.533: D/memalloc(15242): ion: Mapped buffer base:0x5b7eb000 size:2088960 offset:0 fd:92
03-15 10:08:00.533: D/memalloc(15242): ion: Mapped buffer base:0x567dd000 size:4096 offset:0 fd:98
03-15 10:08:00.583: W/(15242): init htc webcore
03-15 10:08:01.234: I/Ads(15242): No fill from ad server.
03-15 10:08:01.254: W/dalvikvm(15242): [GC Control] disableGcForExternalAlloc: false
03-15 10:08:01.254: E/SQLiteLog(15242): (14) cannot open file at line 30178 of [00bb9c9ce4]
03-15 10:08:01.254: E/SQLiteLog(15242): (14) os_unix.c:30178: (2) open(/NotificationPermissions.db) - 
03-15 10:08:01.254: D/WebKit(15242): ERROR: 
03-15 10:08:01.254: D/WebKit(15242): SQLite database failed to load from /NotificationPermissions.db
03-15 10:08:01.254: D/WebKit(15242): Cause - unable to open database file
03-15 10:08:01.254: D/WebKit(15242): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
03-15 10:08:01.264: W/Ads(15242): Failed to load ad: 3

Code

// Create the adView.
adView = new AdView(this);
adView.setAdUnitId(admobUnitID);
adView.setAdSize(AdSize.BANNER);

// Lookup LinearLayout
LinearLayout layout = (LinearLayout)findViewById(R.id.adLayout);

// Add the adView to it.
layout.addView(adView);

// Initiate a generic request.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)       // Emulator
.addTestDevice("A24031FACA2D8B7F7AFB280EB4E87A11")
.build();

// Load the adView with the ad request.
adView.loadAd(adRequest);
like image 635
mike_83 Avatar asked Mar 15 '14 10:03

mike_83


People also ask

Can AdMob work without uploading at Play Store?

You can definitely use Admob without uploading your app to Google Play.

How do I know if AdMob ad is working?

Test devices You can configure your device as a test device and use your own ad unit IDs that you've created in your AdMob account. When you enable a test device, the AdMob Network sends production ads in test mode to your device using the ad unit IDs you've created in your AdMob account.

Why AdMob stop showing ads?

Ads won't show if you haven't integrated the Google Mobile Ads SDK correctly. Is your ad implementation code working properly? Test your implementation code to check that ads can show. You can also use ad inspector to test your app's ad serving.

How long does it take for AdMob to show ads?

Ad serving When apps are newly registered with AdMob, it typically takes up to an hour and a few ad requests to allow inventory to build. Because of this, you may not see live impressions immediately. Note: In some cases, it may take longer than an hour. Please wait 24 hours before seeking additional help.


1 Answers

https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start https://developer.android.com/google/play-services/setup.html

Your Code looks ok

Here's a class to check for google play. If googleplay is not installed it presents a dialog where the user can download it.

Setup project to use google play and add this code to onCreate.

if (!MyGooglePlay.isGooglePlay(getApplicationContext())) {
        myGP = new MyGooglePlay(this);
        myGP.isGooglePlay();
    }

//class MyGooglePlay

import android.app.Dialog;

import android.content.Context;
import android.content.IntentSender;

import android.os.Bundle;
import android.support.v4.app.DialogFragment;

import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBarActivity;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;

public class MyGooglePlay {

    private static final int CONNECTION_FAILURE_RESOLUTION_REQUEST = 8302;
    private ActionBarActivity activity;
    private FragmentManager fragManager;

    public MyGooglePlay(ActionBarActivity activity) {
        this.activity = activity;
        this.fragManager = activity.getSupportFragmentManager();
    }

    public static boolean isGooglePlay(Context context) {
        return (GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS);
    }

    public boolean isGooglePlay() {
        if (isGooglePlay(activity)) {
            return true;
        } else {
            return checkGooglePlay();
        }
    }

    private static final String DIALOG_ERROR = "dialog_error";

    public ErrorDialogFragment errorFragment;

    private boolean checkGooglePlay() {
        int mIsGooglePlayServicesAvailable = GooglePlayServicesUtil
                .isGooglePlayServicesAvailable(activity);

        switch (mIsGooglePlayServicesAvailable) {
        case ConnectionResult.SUCCESS:
            return true;
        default:

            Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
                    mIsGooglePlayServicesAvailable, activity,
                    CONNECTION_FAILURE_RESOLUTION_REQUEST);
            // If Google Play services can provide an error dialog
            if (errorDialog != null) {
                // Create a new DialogFragment for the error dialog
                errorFragment = ErrorDialogFragment.newInstance();
                // Set the dialog in the DialogFragment
                errorFragment.setDialog(errorDialog);

                // Show the error dialog in the DialogFragment
                errorFragment.show(fragManager, "LocationUpdates");
            }
            // case ConnectionResult.SERVICE_MISSING:
            // case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
            // case ConnectionResult.SERVICE_DISABLED:
            // case ConnectionResult.SERVICE_INVALID:
            // case ConnectionResult.DATE_INVALID:
        }

        return false;
    }

    public void dismissMe() {
        DialogFragment frag = (DialogFragment) fragManager
                .findFragmentByTag("LocationUpdates");
        if (frag != null) {
            frag.dismissAllowingStateLoss();
        }
    }

    public static class ErrorDialogFragment extends DialogFragment {
        // Global field to contain the error dialog
        private Dialog mDialog;




        static ErrorDialogFragment newInstance() {
            ErrorDialogFragment d = new ErrorDialogFragment();
            return d;
        }

        // Default constructor. Sets the dialog field to null
        public ErrorDialogFragment() {
            super();
            mDialog = null;
        }

        // Set the dialog to display
        public void setDialog(Dialog dialog) {
            mDialog = dialog;
        }


        public void onPause(){
            super.onPause();
            this.dismissAllowingStateLoss();
        }

        // Return a Dialog to the DialogFragment.
        @Override
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            return mDialog;
        }
    }

    public void onConnectionFailed(ConnectionResult connectionResult) {
        /*
         * Google Play services can resolve some errors it detects. If the error
         * has a resolution, try sending an Intent to start a Google Play
         * services activity that can resolve error.
         */
        if (connectionResult.hasResolution()) {
            try {
                // Start an Activity that tries to resolve the error
                connectionResult.startResolutionForResult(activity,
                        CONNECTION_FAILURE_RESOLUTION_REQUEST);
                /*
                 * Thrown if Google Play services canceled the original
                 * PendingIntent
                 */
            } catch (IntentSender.SendIntentException e) {
                // Log the error
                e.printStackTrace();
            }
        } else {
            /*
             * If no resolution is available, display a dialog to the user with
             * the error.
             */
            showErrorDialog(connectionResult.getErrorCode(), activity);
        }
    }

    /* Creates a dialog for an error message */
    private void showErrorDialog(int errorCode, ActionBarActivity activity) {
        // Create a fragment for the error dialog
        ErrorDialogFragment dialogFragment = new ErrorDialogFragment();
        // Pass the error that should be displayed
        Bundle args = new Bundle();
        args.putInt(DIALOG_ERROR, errorCode);
        dialogFragment.setArguments(args);
        dialogFragment
                .show(activity.getSupportFragmentManager(), "errordialog");
    }

}
like image 78
danny117 Avatar answered Oct 02 '22 14:10

danny117