Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't show admob #14

Open
gclsoft opened this issue Apr 10, 2014 · 1 comment
Open

Can't show admob #14

gclsoft opened this issue Apr 10, 2014 · 1 comment

Comments

@gclsoft
Copy link

gclsoft commented Apr 10, 2014

Can't show admob.There's no example,so I created by myself.But nothing displays.
Tested on iPhone 5 and iPad 4.

In config.xml :
<feature name="AdMobPlugin"> <param name="ios-package" value="AdMobPlugin" /> </feature>

In index.html

    <body onload="onLoad()">

   <script>
                function onLoad() {
                    document.addEventListener("deviceready", onDeviceReady, false);
                }
            function onDeviceReady() {
                var admob_ios_key = 'a151e6d43c5a28f';
                var admob_android_key = 'a151e6d65b12438';
                var adId = (navigator.userAgent.indexOf('Android') >=0) ? admob_android_key : admob_ios_key;

                if ( window.plugins && window.plugins.AdMobPlugin ) {
                                } else {
                    alert('AdMobPlugin plugin not available/ready.');
                }
                   var am = window.plugins.AdMobPlugin;
                                am.createBannerView(
                                                    {
                                                    'publisherId': adId,
                                                    'adSize': am.AD_SIZE.BANNER,
                                                    'bannerAtTop': true
                                                    }, function() {
                                                    am.requestAd( { 'isTesting':false }, function() {
                                                                 am.showAd( true );
                                                                 }, function() {
                                                                 alert('failed to request ad');
                                                                 })
                                                    }, function(){
                                                    alert( "failed to create ad view" );
                                                    });

            }
            </script>    

The "alert('AdMobPlugin plugin not available/ready.');" alerts every time, although I've added plugin sources into work project.

@Voitovych
Copy link

try to use window.admob instead of window.plugins.AdMobPlugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants