Skip to content

Can't show admob #14

@gclsoft

Description

@gclsoft

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions