Intégration de Google Play Admob avec Phonegap

Comment ajouter Google Admob pour phonegap app (android) en 2014?

J'ai vérifié de nombreux exemples en ligne par exemple link1 link2 Link3 Link4. La plupart des lien vers Google sera bientôt obsolète Android 6.4.1 tutoriel.

En dehors de spécifique android ou iOS tutoriels, je ne trouve aucune qui montrent comment mettre en œuvre la dernière admob dans phonegap pour une croix-plate-forme app. J'ai vu inmobi cependant, il semble que vous devez publier votre application avant que vous pouvez obtenir un id d'éditeur pour vos annonces.

Mise à jour avec Android simplifié instructions
Je suis la boîte noire pour l'annonce mais rien d'autre, pas de messages d'alerte, aucune annonce

phonegap create myproject
cd mypproject
phonegap run android

Fermer l'émulateur

1.Install the Google Play Services plugin:  cordova plugin add     https://github.com/MobileChromeApps/google-play-services.git  
2.Install this plugin:  cordova plugin add https://github.com/floatinghotpot/cordova-plugin-admob.git  

Puis je me dirigeais vers index.js et onDeviceReady j'ai ajouté

   onDeviceReady: function() {
     app.receivedEvent('deviceready');

if( window.plugins && window.plugins.AdMob ) {
    var admob_android_key = 'pub-6xxxxxxxxxxxxx';
    var am = window.plugins.AdMob;

    am.createBannerView( 
    {
    'publisherId': admob_android_key,
    'adSize': am.AD_SIZE.BANNER,
    'bannerAtTop': true
    }, 
    function() {
        am.requestAd(
            { 'isTesting':true }, 
            function(){
                am.showAd( true );
            }, 
            function(){ alert('failed to request ad'); }
        );
    }, 
    function(){ alert('failed to create banner view'); }
    );
    } else {
    alert('AdMob plugin not available/ready.');
    }

  }

Ajouté index.html

       <div>
            <button id='show-ad' onClick="if(window.plugins.AdMob){ window.AdMob.plugins.showAd(true); }">Show Ad</button>
            <button id='hide-ad' onClick="if(window.plugins.AdMob){ window.AdMob.plugins.showAd(false); }">Hide Ad</button>
        </div>

phonegap exécuter android

source d'informationauteur Tom