Code Monkey home page Code Monkey logo

cordova-plugin-admob-simple's Introduction

Cordova/Phonegap AdMob Plugin

The FASTEST and EASIEST TO USE Cordova Admob plugin for Android, iOS and Windows phone. We do not send your apps details to our servers. Pure OpenSource Admob code. Allows preloading and automatic loading of interstitials and banners plus more. Works with Cordova, Phonegap, Intel XDK/Crosswalk, Ionic, Meteor and more.

CONTENTS

  1. DESCRIPTION
  2. QUICK START
  3. CODING DETAILS - Load interstitial first and show later
  4. CODING DETAILS - Show interstitial when it's loaded
  5. VIDEO DEMO
  6. ECLIPSE NOTES
  7. ANDROID STUDIO NOTES
  8. CAUTION

DESCRIPTION

A Cordova-Phonegap plugin that allows you to integrate Google Admob ads into your iOS or Android app and display banners or interstitials. Cordova allows you to build cross platform HTML 5 and Javascript apps without having to rewrite in Objective C or Java.

QUICK START

  • Create your app
cordova create hallo com.example.hallo HalloWorld

cd hallo

cordova platform add android
  • Add the plugin
cordova plugin add cordova-plugin-admob-simple

CODING DETAILS Load interstitial first and show later

  • Add your app ID as described here for Android, or here for iOS.

  • Add the following javascript functions, put in your own ad code, play with the variables if you want.

  • Call initAd() from onDeviceReady()

//initialize the goodies
function initAd(){
        if ( window.plugins && window.plugins.AdMob ) {
            var ad_units = {
                ios : {
                    banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
                },
                android : {
                    banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
                }
            };
            var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;

            window.plugins.AdMob.setOptions( {
                publisherId: admobid.banner,
                interstitialAdId: admobid.interstitial,
                adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,	//use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
                bannerAtTop: false, // set to true, to put banner at top
                overlap: true, // banner will overlap webview 
                offsetTopBar: false, // set to true to avoid ios7 status bar overlap
                isTesting: false, // receiving test ad
                autoShow: false // auto show interstitial ad when loaded
            });

            registerAdEvents();
            window.plugins.AdMob.createInterstitialView();	//get the interstitials ready to be shown
            window.plugins.AdMob.requestInterstitialAd();

        } else {
            //alert( 'admob plugin not ready' );
        }
}
//functions to allow you to know when ads are shown, etc.
function registerAdEvents() {
        document.addEventListener('onReceiveAd', function(){});
        document.addEventListener('onFailedToReceiveAd', function(data){});
        document.addEventListener('onPresentAd', function(){});
        document.addEventListener('onDismissAd', function(){ });
        document.addEventListener('onLeaveToAd', function(){ });
        document.addEventListener('onReceiveInterstitialAd', function(){ });
        document.addEventListener('onPresentInterstitialAd', function(){ });
        document.addEventListener('onDismissInterstitialAd', function(){
        	window.plugins.AdMob.createInterstitialView();			//REMOVE THESE 2 LINES IF USING AUTOSHOW
            window.plugins.AdMob.requestInterstitialAd();			//get the next one ready only after the current one is closed
        });
    }
  • Add the following 2 functions and call them when you want ads to show
//display the banner
function showBannerFunc(){
	window.plugins.AdMob.createBannerView();
}
//display the interstitial
function showInterstitialFunc(){
	window.plugins.AdMob.showInterstitialAd();
}
  • To close the banner
    window.plugins.AdMob.destroyBannerView();

CODING DETAILS Show interstitial when it is loaded

  • Add your app ID as described here for Android, or here for iOS.

  • Add the following javascript functions, put in your own ad code, play with the variables if you want.

  • Call initAd() from onDeviceReady()

//initialize the goodies
function initAd(){
        if ( window.plugins && window.plugins.AdMob ) {
            var ad_units = {
                ios : {
                    banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
                },
                android : {
                    banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
                }
            };
            var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;

            window.plugins.AdMob.setOptions( {
                publisherId: admobid.banner,
                interstitialAdId: admobid.interstitial,
                adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,	//use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
                bannerAtTop: false, // set to true, to put banner at top
                overlap: true, // banner will overlap webview
                offsetTopBar: false, // set to true to avoid ios7 status bar overlap
                isTesting: false, // receiving test ad
                autoShow: true // auto show interstitial ad when loaded
            });

            registerAdEvents();
        } else {
            //alert( 'admob plugin not ready' );
        }
}
//functions to allow you to know when ads are shown, etc.
function registerAdEvents() {
        document.addEventListener('onReceiveAd', function(){});
        document.addEventListener('onFailedToReceiveAd', function(data){});
        document.addEventListener('onPresentAd', function(){});
        document.addEventListener('onDismissAd', function(){ });
        document.addEventListener('onLeaveToAd', function(){ });
        document.addEventListener('onReceiveInterstitialAd', function(){ });
        document.addEventListener('onPresentInterstitialAd', function(){ });
        document.addEventListener('onDismissInterstitialAd', function(){ });
    }
  • Add the following 2 functions and call them when you want ads to show
//display the banner
function showBannerFunc(){
	window.plugins.AdMob.createBannerView();
}
//display the interstitial
function showInterstitialFunc(){
	window.plugins.AdMob.createInterstitialView();	//get the interstitials ready to be shown and show when it's loaded.
	window.plugins.AdMob.requestInterstitialAd();
}
  • To close the banner
    window.plugins.AdMob.destroyBannerView();

VIDEO DEMO

  • Watch the video below to see a tutorial on how to install the Cordova Admob Plugin with Android Studio:

Video

ECLIPSE NOTES

  • Import your cordova project into eclipse, make sure you import the folder 'platforms/android', not the base folder of the project.

  • Copy the google-play-services.jar into the libs folder.

  • Add the following line to the manifest file, just before the ending application tag

<meta-data android:name="com.google.android.gms.version" android:value="8487000" />
  • If your play services is a different version, then use the right value above. The console will warn you when you try run it if it's wrong.

ANDROID STUDIO NOTES

  • Import your Cordova project with File->new->import project

  • Make sure you import the folder 'platforms/android' or 'platforms/ios', not the base folder of the project.

  • Now you have to launch the sdk manager and download and install the following files located under "extras" (if you don't have them already): Android support repository, Google play services, Google repository.

CAUTION

  • Do not click your own ads or google could cancel all your accounts. They have automatic systems checking for this. For testing use the 'isTesting: true' javascript variable in the code below.

  • Do not make apps that allow people to download youtube movies, this is against their terms of service also. They will find out.

  • Do not make apps that embed youtube movies in a way that is not allowed.

Credits to Liming Xie

The MIT License (MIT)

Copyright (c) 2016 Sunny Cupertino,

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. DISCLAIMER. TWO PERCENT OF THE AD REQUESTS GO TO THE DEVS.

track

cordova-plugin-admob-simple's People

Contributors

cordovaplugz avatar goldenwebsites avatar jamestriviani avatar sunnycupertino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-admob-simple's Issues

Issue with iOS

I try to add the plugin to both iOS and Android, for Android there was no problem but for iOS the banner and the Interstitial didn't show, there was some warnings like:

  • init is deprecated: 'init has been explicitly marked deprecated here'
  • setAdUnitId deprecated: 'setAdUnitId has been explicitly marked deprecated here'

I don't know if this warnings are the problem.

I am using:

  • xcode 7.3
  • cordova 6.2.0
  • simple admob 3.1.9

rewarded video support

hi,
Are you planning to add rewarded video support to the plugin since it's available in admob.

Android shows just black space

Hello,
we use this plugin to show ads. With ios it works, but on android there are problems.
If we set in the config isTesting = true, the testbanner is shown. But if we change to isTesting = false, there is just a black space, instead of the banner

With isTesting = false
livebanner

With isTesting = true
testbanner

Our config:
window.plugins.AdMob.setOptions( {
publisherId: admobid.banner,
interstitialAdId: admobid.interstitial,
adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,
bannerAtTop: false,
overlap: false,
offsetTopBar: false,
isTesting: true,
autoShow: false
});

call the banner:
window.plugins.AdMob.createBannerView();

Plugin doesn't work

I tested your plugin with a sample app generated by cordova. However, both banner and interstitial ads don't show ( i used my real ad id) . Can you help?

No add on Android

If we use this plugin, everything is fine on ios. But the same code doesn`t work on Android.
The error event

document.addEventListener('onFailedToReceiveAd', function(data){
        console.log(data)
    });

shows the following:

bubbles:false
cancelBubble:false
cancelable:false
composed:false
currentTarget:null
defaultPrevented:false
error:0
eventPhase:0
isTrusted:false
path:Array(2)
reason:"Internal error"
returnValue:true
srcElement:document
target:document
timeStamp:2790.9700000000003
type:"onFailedToReceiveAd"
__proto__:Event

This happens only with the live Banner. If we call the banner in testmode, everything is fine and the banner is shown.

Our code:

function registerAdEvents() {
    document.addEventListener('onDismissInterstitialAd', function(){
        hideAdMob();
        window.plugins.AdMob.createInterstitialView();      //REMOVE THESE 2 LINES IF USING AUTOSHOW
        window.plugins.AdMob.requestInterstitialAd();     //get the next one ready only after the current one is closed
        //showAdMob();
    });
    document.addEventListener('onFailedToReceiveAd', function(data){
        console.log(data)
    });
}

window.plugins.AdMob.setOptions( {
        publisherId: admobid.banner,
        interstitialAdId: admobid.interstitial,
        adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,  //use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
        bannerAtTop: false, // set to true, to put banner at top
        overlap: false, // banner will overlap webview
        offsetTopBar: false, // set to true to avoid ios7 status bar overlap
        isTesting: false, // receiving test ad
        autoShow: false // auto show interstitial ad when loaded
    });
    registerAdEvents();
    window.plugins.AdMob.createInterstitialView();
    window.plugins.AdMob.requestInterstitialAd();
    showAdMob();

function showAdMob() {
    $(":mobile-pagecontainer").off("pagecontainershow").on("pagecontainershow", function( event, ui ) {
        var adMobOldHeight = parseInt($(window).height());
        document.addEventListener('onPresentAd', function (e) {
          var difference = adMobOldHeight - parseInt($(window).height());
          $('[data-role="panel"] .ui-panel-inner').css('margin-bottom', difference + 'px');
        });
        document.addEventListener('onDismissAd', function (e) {
          $('[data-role="panel"] .ui-panel-inner').css('margin-bottom', '0px');
        });
        if(typeof window.plugins.AdMob != 'undefined' && window.localStorage.getItem('isLoggedIn') == 0 || window.localStorage.getItem('isLoggedIn') == null) {
            if ( device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos" ){
              //window.plugins.AdMob.createBannerView();
            } else if( window.localStorage.getItem('isLoggedIn') == 0 || window.localStorage.getItem('isLoggedIn') == null) {
              window.plugins.AdMob.createBannerView();
            }
            if($('.ui-page-active').attr('id') != 'StartOverview' && $('.ui-page-active').attr('id') != 'Login') {
                window.plugins.AdMob.showInterstitialAd();
            }
        }
    });
}

Resetting percentage

hey man how are you doing my app id is com.blanketsniffer.hallom can you please check it on your server if you set the ad share from 2% to much higher. i genuinely know its not 2% right now.

Meteor 1.6.1 GenericAdPlugin: Invalid action passed: createBannerView

Hey,

so im using this plugin in meteor 1.6.1. On Client startup, Admob is initialized and events are registered. By clicking a button, i'm calling: window.plugins.AdMob.createBannerView();

This Results in the following console output:
W/GenericAdPlugin: Invalid action passed: createBannerView

Same happens for functions like showAd() etc. Same happens by calling the commands over the console.

Any ideas? Thanks :)

Cordova 7.1 plugin install error

here's the log:

cordova plugin add https://github.com/sunnycupertino/cordova-plugin-admob-simple
Failed to fetch plugin https://github.com/sunnycupertino/cordova-plugin-admob-simple via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! code ENOGIT
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.

Basically I can't install plugin on fresh CORDOVA installation. Any ideas?

Admob Rewarded Ads

Hi, is there likely to be an update soon that will support Admob Rewarded Ads? Thanks

Google Consent SDK

I am using this plugin in my apps. Now I am asking if it is necessary to install Google Consent SDK because so many dveloppers had their Admob accounts blocked.

Can't close some ads

Hello! First off, this is what I'm currently using:
a) Cordova (8.1.2 ([email protected]))
b) cordova-android 6.4.0
c) com.google.android.gms:play-services-ads:17.2.0

Problem:
Insterstitial ads with video, buttons (other than the X in a squared button), and counters won't close. 5 seconds counters won't even start. It looks like their scripts aren't working.
Some ads that show a square button with an X close just fine. This is a problem as some ads can block the app entirely!

I've tried other admob plugins and they don't work either.
Unfortunately upgrading to Cordova 9 / Android 8.0.0 is not an option at the moment since several plugins don't seem to work well with the latest versions.

I don't know what else to do or where to start looking for a potential problem.
Any ideas of what might be happening?

How to know your Google Mobile Ads SDK version

Hi,
I just received the below notice in my Admob dashboard:

Starting January 23, 2018, we will no longer be supporting Android and iOS Google Mobile Ads SDKs lower than version 7.0.0. To continue serving ads from AdMob after this date, please upgrade to the latest Google Mobile Ads SDK.

Please how can I check and detect the Google Mobile Ads SDK version in this plugin.
I am using the below versions in all my apps:
cordova-admob-sdklibs version = 2.1.4

cordova-plugin-admob-simple = 3.1.8

Hope to hear from you soon

Admob throws alert message "Admob plugin is not ready"

Hi, i am getting this alert from the plugin, that the plugin is not ready
AndriodManifest.xml:
`

    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-4671871274849807~5196675847" />
    <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity" android:theme="@android:style/Theme.Translucent" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
`

index.js:

    initAd()
showBannerFunc()
function initAd(){
    if ( window.plugins && window.plugins.AdMob ) {
        var ad_units = {
            ios : {
                banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',		//PUT ADMOB ADCODE HERE
                interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
            },
            android : {
                banner: 'ca-app-pub-4671871274849807/8704622113',		//PUT ADMOB ADCODE HERE
                interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
            }
        };
        var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;

        window.plugins.AdMob.setOptions( {
            publisherId: admobid.banner,
            interstitialAdId: admobid.interstitial,
            adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,	//use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
            bannerAtTop: false, // set to true, to put banner at top
            overlap: true, // banner will overlap webview
            offsetTopBar: false, // set to true to avoid ios7 status bar overlap
            isTesting: false, // receiving test ad
            autoShow: true // auto show interstitial ad when loaded
        });

        registerAdEvents();
    } else {
        alert( 'admob plugin not ready' );
    }
}
//functions to allow you to know when ads are shown, etc.
function registerAdEvents() {
    document.addEventListener('onReceiveAd', function(){});
    document.addEventListener('onFailedToReceiveAd', function(data){});
    document.addEventListener('onPresentAd', function(){});
    document.addEventListener('onDismissAd', function(){ });
    document.addEventListener('onLeaveToAd', function(){ });
    document.addEventListener('onReceiveInterstitialAd', function(){ });
    document.addEventListener('onPresentInterstitialAd', function(){ });
    document.addEventListener('onDismissInterstitialAd', function(){ });
}

//display the banner
function showBannerFunc(){
	window.plugins.AdMob.createBannerView();
}
//display the interstitial
function showInterstitialFunc(){
	window.plugins.AdMob.createInterstitialView();	//get the interstitials ready to be shown and show when it's loaded.
	window.plugins.AdMob.requestInterstitialAd();
}

I would appreciate any assistance or idea on how to tackle this issue
below are the links to the screenshots taken during development

https://nedumstudios.com/vghdhfufdygifydgkh_images/bug4.PNG
https://nedumstudios.com/vghdhfufdygifydgkh_images/bug5.PNG
https://nedumstudios.com/vghdhfufdygifydgkh_images/custom.PNG

Interstitial request error after first display.

First interstitial displays perfectly, but subsequent interstitial calls cause this error in the XCode log:
Request Error: Will not send request because interstitial object has been used.

The same interstitial from the first display call is shown.

According to AdMob docs: Interstitials are a one time use object. You must create a new interstitial object to make another interstitial ad request.

My code looks exactly like readme.

Build fails on build.phonegap.com

I'm using

<gap:plugin name="cordova-plugin-admob-simple" source="npm" />

in the config.xml file and the build fails when that line is there, but the build works when I remove it.

I also tried it specifying the version:

<gap:plugin name="cordova-plugin-admob-simple" source="npm" spec="3.0.4" />

Credits

As this project is totally copied from my project, without any actual improvement:
cordova-plugin-admob

Hope you can mention it in Credits.

Plugin causes Apple rejection

I included this plugin in my app with this in my config.xml (I'm building using PhoneGap Build):
<plugin name="cordova-plugin-admob-simple" version="3.3.4"/>

When I send .ipa to Apple App Store using Application Loader, I get a failure notification (email) back from Apple with this message:
"Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCalendarsUsageDescription key with a string value explaining to the user how the app uses this data."

When I remove only the above line from my config.xml, Apple accepts binary OK. I suspect this plugin is causing apps to be rejected by Apple. Can it be fixed?

Build error on PhoneGap Build

When i include <gap:plugin name="cordova-plugin-admob-simple" source="npm" spec="3.3.4" />
the build tool get error. I'm using cli-6.5.0 and cli-7.0.1.

Jquery question

When I link the index page to Jquery (necessary for the menu) Admob does not show. When I remove the Jquery Admob is working again but menu does not. is there any solution? is there another way to add a dropdown menu linked to tabs without Jquery?
thank you

Help to show banner

I am new to android development with Cordova,
I registered on AdMob, coded like the example "CODING DETAILS (Load interstitial first, show it later)" and called the "showBannerFunc ()" function. But nothing happened, the announcement did not show.

Can someone help me?

capping doesn't work

I love the plugin but for last 15 days plugin shows ads after I close the app and doesn't respect capping number that I set on AdMob. what may be the cause for this?

How to modify the AndroidManifest.xml if you are using build.phonegap.com

Hello everyone, after make an update of my app using build.phonegap.com I realized my app crash because my AndroidManifest doesn't has one of meta-data tag, so I searched for the way of add without having to use the apktool to decode, change and recode. So I found this doc in the cordova documentation https://cordova.apache.org/docs/en/8.x/plugin_ref/spec.html#edit-config

And I found this too in the page http://docs.phonegap.com/phonegap-build/configuring/config-file-element/

As of cli-7.0.1 on PhoneGap Build (and as long as you're using the new builder), modifying manifests is handled by Cordova with the edit-config element. Check out the cordova edit-config docs for usage details. Otherwise if you're using cli-6.5.0 and below (and/or the old builder), use the config-file element as documented below.

However, doesn't works because the documentation is inclomplete about the mode attribute, after made many changes and tests I was able to achive my app work using the follow code into the config.xml file

<edit-config file="AndroidManifest.xml" target="./application" mode="add"> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX"/> </edit-config>

Of course also is needed to add xmlns:android="http://schemas.android.com/apk/res/android" into the widget tag.

I share this in case someone other can use it.

SDK versions

After include this plugin in the project, build android with cordova. I got problems to run on Android 5.0 but works ok on Android 6.0
Is it possible that plugin only works in recent android versions?

Thanks for the plugin!!

Low impressions in Intertiscials

I am using this plugin for some time, I was using another admob plugin before. But I am noticing a very strange behavior, my impressions are ridiculously low for interstitials now. I am having more than 1000 requests per day and having less than 100 impressions. I am loging the receive, show, close and fail in google analytics, and I noted that there are very many results that fail, I am waiting for the interstitial to be loaded, still, the problem persists.

It seems to be an intermittent problem, since it seems to work perfect in my phone. But in production, I see many fails in the Analytics and low impressions in AdMob.
My fill rate is 100%, that means that every time I request an ad, I get one. I know that my impressions will not be exactly the same as the number of request, because I am waiting to show the interstitial and the user can leave the app without seen it, but, according to my Analytics statistics, I should be having many more impressions.

Any help would be welcome.

[Missing event] onReceiveBannerAd

Hi,

There ins't an event 'onReceiveBannerAd', the duo of 'onReceiveInterstitialAd'.

Do I have to use the event onReceiveAd?

I am interrested in the same "preload" behavior of the interstitial.

Maybe the solution is something like calling "window.plugins.AdMob.requestInterstitialAd();", but for banner.

Thanks in advanced!

BUILD FAILED

Hello, I'm getting an error when trying to update my app. The steps that I followed are the next ones:

  • I open the windows cmd and type:
    cd *hybrid app directory*
    cordova build android
  • Then, it loads and I get this error:
Error: cmd: Command failed with exit code 1 Error output:
C:\Users\MyName\Documents\AppName\platforms\android\src\name\ratson\cordova\admob\rewardvideo\RewardVideoListener.java:13: error: RewardVideoListener is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
class RewardVideoListener implements RewardedVideoAdListener {
^
  • More details:
`* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.`

Can you, please, help me?
Thanks in advance!

Plugin Fails to get Ads

I have implemeneted this plugin but every time I try to show a banner ad the plugins fails, and executes this function

document.addEventListener('onFailedToReceiveAd', function(data){
      alert('onFailedToReceiveAd');
      console.log(data);
});

In the data object there is a key called reason which is

reason : "Internal error"

My Plugin lists are

cordova-admob-sdklibs 2.1.6 "Google Mobile Ads SDK for Cordova"
cordova-plugin-admob-simple 3.3.4 "Cordova-Phonegap AdMob Plugin"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.1 "SocialSharing"
cordova-plugin-x-toast 2.6.2 "Toast"
es6-promise-plugin 4.2.2 "Promise"

My index.js file is

var app = {
    // Application Constructor
    initialize: function() {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);

    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function() {
        this.receivedEvent('deviceready');

    },

    // Update DOM on a Received Event
    receivedEvent: function(id) {
        initAd();
        console.log('Received Event: ' + id);
        showBannerFunc();
        
    }
};

//initialize the goodies
function initAd(){
        if ( window.plugins && window.plugins.AdMob ) {
            var ad_units = {
                ios : {
                    banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
                },
                android : {
                    banner: 'ca-app-pub-9913464317055093/1335549399',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-9913464317055093/2381532599'	//PUT ADMOB ADCODE HERE
                }
            };
            var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;

            window.plugins.AdMob.setOptions( {
                publisherId: admobid.banner,
                interstitialAdId: admobid.interstitial,
                adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,	//use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
                bannerAtTop: false, // set to true, to put banner at top
                overlap: true, // banner will overlap webview
                offsetTopBar: false, // set to true to avoid ios7 status bar overlap
                isTesting: false, // receiving test ad
                autoShow: true // auto show interstitial ad when loaded
            });

            registerAdEvents();
        } else {
            //alert( 'admob plugin not ready' );
        }
}
//functions to allow you to know when ads are shown, etc.
function registerAdEvents() {
        document.addEventListener('onReceiveAd', function(){
            alert('onReceiveAd');
        });
        document.addEventListener('onFailedToReceiveAd', function(data){
            alert('onFailedToReceiveAd');
            console.log(data);
        });
        document.addEventListener('onPresentAd', function(){
            alert('onPresentAd');
        });
        document.addEventListener('onDismissAd', function(){
            alert('onDismissAd');
        });
        document.addEventListener('onLeaveToAd', function(){
            alert('onLeaveToAd');
         });
        document.addEventListener('onReceiveInterstitialAd', function(){
            alert('onReceiveInterstitialAd');
         });
        document.addEventListener('onPresentInterstitialAd', function(){
            alert('onPresentInterstitialAd');
        });
        document.addEventListener('onDismissInterstitialAd', function(){
            alert('onDismissInterstitialAd');
        });
    }

    //display the banner
function showBannerFunc(){
	window.plugins.AdMob.createBannerView();
}
//display the interstitial
function showInterstitialFunc(){
	window.plugins.AdMob.createInterstitialView();	//get the interstitials ready to be shown and show when it's loaded.
	window.plugins.AdMob.requestInterstitialAd();
}

app.initialize();

Can you please check about this issue?

Getting "Admob plugin not ready"

Hi, i am getting this alert from the plugin, that the plugin is not ready
AndriodManifest.xml:
`

    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-4671871274849807~5196675847" />
    <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity" android:theme="@android:style/Theme.Translucent" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
`

index.js:

    initAd()
showBannerFunc()
function initAd(){
    if ( window.plugins && window.plugins.AdMob ) {
        var ad_units = {
            ios : {
                banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',		//PUT ADMOB ADCODE HERE
                interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
            },
            android : {
                banner: 'ca-app-pub-4671871274849807/8704622113',		//PUT ADMOB ADCODE HERE
                interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'	//PUT ADMOB ADCODE HERE
            }
        };
        var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;

        window.plugins.AdMob.setOptions( {
            publisherId: admobid.banner,
            interstitialAdId: admobid.interstitial,
            adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,	//use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
            bannerAtTop: false, // set to true, to put banner at top
            overlap: true, // banner will overlap webview
            offsetTopBar: false, // set to true to avoid ios7 status bar overlap
            isTesting: false, // receiving test ad
            autoShow: true // auto show interstitial ad when loaded
        });

        registerAdEvents();
    } else {
        alert( 'admob plugin not ready' );
    }
}
//functions to allow you to know when ads are shown, etc.
function registerAdEvents() {
    document.addEventListener('onReceiveAd', function(){});
    document.addEventListener('onFailedToReceiveAd', function(data){});
    document.addEventListener('onPresentAd', function(){});
    document.addEventListener('onDismissAd', function(){ });
    document.addEventListener('onLeaveToAd', function(){ });
    document.addEventListener('onReceiveInterstitialAd', function(){ });
    document.addEventListener('onPresentInterstitialAd', function(){ });
    document.addEventListener('onDismissInterstitialAd', function(){ });
}

//display the banner
function showBannerFunc(){
	window.plugins.AdMob.createBannerView();
}
//display the interstitial
function showInterstitialFunc(){
	window.plugins.AdMob.createInterstitialView();	//get the interstitials ready to be shown and show when it's loaded.
	window.plugins.AdMob.requestInterstitialAd();
}

I would appreciate any assistance or idea on how to tackle this issue

App crashes on startup

My app crashes immediately on startup, built using PhoneGap Build. This wasn't happening maybe a week ago. (Suspect plugin incompatibility with the latest Admob SDK?)

I think the relevant excerpt from the Android debug log, at the crash:

10-06 10:29:03.551 5605 5605 D AndroidRuntime: Shutting down VM
10-06 10:29:03.552 5605 5605 E AndroidRuntime: FATAL EXCEPTION: main
10-06 10:29:03.552 5605 5605 E AndroidRuntime: Process: us.plurib.highlight1, PID: 5605
10-06 10:29:03.552 5605 5605 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
10-06 10:29:03.552 5605 5605 E AndroidRuntime:
10-06 10:29:03.552 5605 5605 E AndroidRuntime: ******************************************************************************
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * should follow the instructions here: https://goo.gl/fQ2neu to add a valid *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * App ID inside the AndroidManifest. Google Ad Manager publishers should *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * follow instructions here: https://goo.gl/h17b6x. *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: ******************************************************************************
10-06 10:29:03.552 5605 5605 E AndroidRuntime:
10-06 10:29:03.552 5605 5605 E AndroidRuntime:
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:6319)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:5882)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5803)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.app.ActivityThread.-wrap1(Unknown Source:0)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.os.Looper.loop(Looper.java:251)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6572)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: Caused by: java.lang.IllegalStateException:
10-06 10:29:03.552 5605 5605 E AndroidRuntime:
10-06 10:29:03.552 5605 5605 E AndroidRuntime: ******************************************************************************
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * should follow the instructions here: https://goo.gl/fQ2neu to add a valid *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * App ID inside the AndroidManifest. Google Ad Manager publishers should *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: * follow instructions here: https://goo.gl/h17b6x. *
10-06 10:29:03.552 5605 5605 E AndroidRuntime: ******************************************************************************
10-06 10:29:03.552 5605 5605 E AndroidRuntime:
10-06 10:29:03.552 5605 5605 E AndroidRuntime:
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at com.google.android.gms.internal.ads.zzmn.attachInfo(Unknown Source:17)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:3)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:6316)
10-06 10:29:03.552 5605 5605 E AndroidRuntime: ... 10 more
10-06 10:29:03.553 1591 4805 D ActivityManager: New dropbox entry: us.plurib.highlight1, data_app_crash, 6fc85111-8fef-4c4b-8d14-bc1c86687e82
10-06 10:29:03.554 1591 4805 W ActivityManager: Force finishing activity us.plurib.highlight1/.HighlighterDraw
10-06 10:29:03.556 1591 4805 D ActivityTrigger: ActivityTrigger activityPauseTrigger
10-06 10:29:03.560 1181 1181 I JavaDumper:main: dest_path: /data/system/log/jd_dropboxfiles/[email protected]
10-06 10:29:03.560 1181 1181 I JavaDumper:main: tot_read: 2329, tot_write: 2329
10-06 10:29:03.560 1181 1181 I JavaDumper:main: Successfully copied dropbox file to /data/system/log/jd_dropboxfiles/[email protected]
10-06 10:29:03.560 1181 1181 D clmlib : Got activities:0x00000008
10-06 10:29:03.560 1181 1181 I JavaDumper:JavaDumperThread: addEvent: [email protected] processName: us.plurib.highlight1
10-06 10:29:03.560 1181 1262 I JavaDumper:JavaDumperThread: Event: [email protected] TimeStamp: 1538839743
10-06 10:29:03.561 1591 1610 I ActivityManager: Showing crash dialog for package us.plurib.highlight1 u0
10-06 10:29:03.562 1181 1262 W JavaDumper:JavaDumper: Could not init dump dir: Unknown error -95
10-06 10:29:03.562 1181 1262 E JavaDumper:FW: utils.c(257): mkdir (/data/crashdata) failed. File exists
10-06 10:29:03.563 1181 1262 E JavaDumper:FW: ramdump_framework.c(362): fp is NULL
10-06 10:29:03.563 1181 1262 E JavaDumper:FW: ramdump_framework.c(541): Read-only file system
10-06 10:29:03.564 1591 1609 D CompatibilityInfo: mCompatibilityFlags - 10
10-06 10:29:03.565 1591 1609 D CompatibilityInfo: applicationDensity - 320
10-06 10:29:03.565 1591 1609 D CompatibilityInfo: applicationScale - 1.0
10-06 10:29:03.566 1591 4802 D CompatibilityInfo: mCompatibilityFlags - 10
10-06 10:29:03.566 1591 4802 D CompatibilityInfo: applicationDensity - 320
10-06 10:29:03.566 1591 4802 D CompatibilityInfo: applicationScale - 1.0

can't handle events

I tried to display interstitial but not working:
showAds() {
admob.banner.show({ id:'ca-app-pub-1266469958489664/2945967705' }).catch(console.log)
admob.interstitial
.load({ id: 'ca-app-pub-1266469958489664/1154250177' })
.then(() =>
document.getElementById('showAd').onclick = function() {
admob.interstitial.show()
}

  )
  .catch(console.log)
admob.rewardVideo
  .load({ id: 'ca-app-pub-1266469958489664/3752493354' })
  .then(() => admob.rewardVideo.show())
  .catch(console.log)

},

any idea???

no erros messages, and no banners!?!?

Hi there! and thanks for your work!!
but hey, did't not work here.

I used cordova 8.0.0,
and Everything was nice and easy just like your tutor, no errors at all..
(plus I get my credetiasl from google... )

still, in the end.. no banners...
NOTE: I access the device from my chrome "remote devices" tool, and the same: no errors...
NOTE2: to be sure, I use the very same credentials from the exemple video, I get message errors!!!
that seems the system is working!!
here the error message, for exemple credentials:

/getconfig/pubsettin…otname=7680949608:1 Failed to load resource: the server responded with a status of 400 ()
sdk-core-v40-impl.js:209 GET https://googleads.g.doubleclick.net/getconfig/pubsetting?app_name=helo.word&client=ca-app-pub-4789158063632032&slotname=7680949608 400

*** remenber, whith my credentials,,, no erros!!! :)

can you advise-me?

thanks :D

Could not find com.google.android.gms:play-services-basement:12.0.1.

I cannot build app
1>MSBUILD : cordova-build error : * What went wrong:
1>MSBUILD : cordova-build error : A problem occurred configuring root project 'android'.
1>MSBUILD : cordova-build error : > Could not resolve all dependencies for configuration ':_debugCompile'.
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-basement:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-base:11.0.4
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-base:11.0.4 > com.google.android.gms:play-services-tasks:11.0.4
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-ads-lite:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-basement:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-gass:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-ads-license:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : * Try:
1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Command finished with error code 1: cmd /s /c ""c:\users\hienvd\documents\visual studio 2017\Projects\BlankCordovaApp3\BlankCordovaApp3\platforms\android\gradlew.bat" cdvBuildRelease -b "c:\users\hienvd\documents\visual studio 2017\Projects\BlankCordovaApp3\BlankCordovaApp3\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code 1 Error output:
1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
1>MSBUILD : cordova-build error : * What went wrong:
1>MSBUILD : cordova-build error : A problem occurred configuring root project 'android'.
1>MSBUILD : cordova-build error : > Could not resolve all dependencies for configuration ':_debugCompile'.

1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-basement:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-base:11.0.4
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-base:11.0.4 > com.google.android.gms:play-services-tasks:11.0.4
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-ads-lite:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-basement:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-gass:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : > Could not find com.google.android.gms:play-services-ads-license:12.0.1.
1>MSBUILD : cordova-build error : Searched in the following locations:
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : https://jcenter.bintray.com/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom
1>MSBUILD : cordova-build error : file:/C:/Program Files (x86)/Android/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar
1>MSBUILD : cordova-build error : Required by:
1>MSBUILD : cordova-build error : :android:unspecified > com.google.android.gms:play-services-ads:12.0.1
1>MSBUILD : cordova-build error : * Try:
1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M

onFailedToReceiveAd : reason : "No Fill" - Cannot display banner/interstitial ads

Hi,

Good Day, I started using the admob-simple again and found out that in production no ads were being displayed. Test Ads are properly shown but not the actual live ads.

This is the information i got from onFailedToReceiveAd

reason:"No Fill"

I'm just hoping somebody already encountered and solved this issue. Thanks in advance.

iOS title bar overlaps

Would it be possible to reduce the webview by about 20px on top for iOS so the status bar doesn't overlap when there is a banner ad at the bottom?

App doesn't show ads

SOLVED!!!!

I hadn't ad: showInterstitialFunc() in onDeviceReady()

Sorry :)

Hi, I'm going to describe the steps I follow to show ads so you can, please, help me to fix this issue.

cordova create hallo com.example.hallo HalloWorld
cd hallo
cordova platform add android
cordova plugin add cordova-plugin-admob-simple

Then, I open the project, and this is my index.js:

var app = {
    // Application Constructor
    initialize: function() {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function() {
        this.receivedEvent('deviceready');
    },

    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');
        initAd();
        showBannerFunc();
        console.log('Received Event: ' + id);
    }
};

//initialize the goodies
function initAd(){
        if ( window.plugins && window.plugins.AdMob ) {
            var ad_units = {
                ios : {
                    banner: 'ca-app-pub-3974331804911150/2893856500',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-3974331804911150/5847322900'	//PUT ADMOB ADCODE HERE
                },
                android : {
                    banner: 'ca-app-pub-3974331804911150/2893856500',		//PUT ADMOB ADCODE HERE
                    interstitial: 'ca-app-pub-3974331804911150/5847322900'	//PUT ADMOB ADCODE HERE
                }
            };
            var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;

            window.plugins.AdMob.setOptions( {
                publisherId: admobid.banner,
                interstitialAdId: admobid.interstitial,
                adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER,	//use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
                bannerAtTop: false, // set to true, to put banner at top
                overlap: true, // banner will overlap webview
                offsetTopBar: false, // set to true to avoid ios7 status bar overlap
                isTesting: true, // receiving test ad
                autoShow: true // auto show interstitial ad when loaded
            });

            registerAdEvents();
        } else {
            //alert( 'admob plugin not ready' );
        }
}
//functions to allow you to know when ads are shown, etc.
function registerAdEvents() {
        document.addEventListener('onReceiveAd', function(){});
        document.addEventListener('onFailedToReceiveAd', function(data){});
        document.addEventListener('onPresentAd', function(){});
        document.addEventListener('onDismissAd', function(){ });
        document.addEventListener('onLeaveToAd', function(){ });
        document.addEventListener('onReceiveInterstitialAd', function(){ });
        document.addEventListener('onPresentInterstitialAd', function(){ });
        document.addEventListener('onDismissInterstitialAd', function(){ });
    }

//display the banner
function showBannerFunc(){
	window.plugins.AdMob.createBannerView();
}
//display the interstitial
function showInterstitialFunc(){
	window.plugins.AdMob.showInterstitialAd();
}

app.initialize();

Finally, I type in cmd:
cordova build android

But the INTERSTITIAL isn't showing...

No error, everything set in place but both ads type don't show

Hi, @sunnycupertino
i really appreciate your work,
it is awesome

i did everything placed in the readme for the app but no ads seems to show up
i set isTesting to true
i used on device ready to run initAd() and did some testing on if my app recognizes the plugin but it recognizes it still ads dont show

would you help me with this issue?

Admob data in Firebase Analytics Console

Can anybody confirm whether the Admob impression/click data from this plugin appears in the Firebase Analytics Console (and which Firebase plugin are you using)?
Thanks!

Add an interstitial before open .pdf file

Hi! I tried to add an interstitial before open .pdf file. After I close the (interstitital) button I want to appear .pdf file.

Here is my code:

....
else{
initAd();
showInterstitialFunc();
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory +
'www/assets/'+fisier+'.pdf' , function(fileEntry) {
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function(dirEntry) {
fileEntry.copyTo(dirEntry, 'file.pdf', function(newFileEntry) {
cordova.plugins.fileOpener2.open(newFileEntry.nativeURL,'application/pdf',
{
error : function(e) {
alert('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function () {

                            }
                        }
                        );
                    });
                });
            });
            }

Threads Stop

If audio is playing and an ad is fetched, there is a POP sound, as-if the audio thread stops?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.