2017-05-09 24 views
0

私は知恵袋で終わりです。私はこのプラグインを動作させることができません。私はPhoneGap Cordova Admob plugin not working(あなたがこのプラグインを参照する答えにスクロールするとき)の手紙を手紙に従っています。私はphonegapと一緒に走っている最新のphonegap cliを使用しています。私は空のページ(debug.html)を作成して、他のコードが干渉していないことを確認しました。私がこれまで行ってきた何Phonegap cordova-plugin-admob-simple広告が表示されません

:プラグインがAdmob.jsファイルが実際にプラグインフォルダからロードされたメインconfig.xmlのウェブbroswerにチェック

  • に存在していたことを確認しました

    • 。プラグインはプラットフォーム/アンドロイドで参照/ android.json
    • が、私はプラグインがプラットフォーム/アンドロイド/資産/ www /のプラグイン
    • に位置していたことを確認した
    • ページにcordova.jsをリンクしてくださいましたことを確認した
    • プラットフォームのアンドロイドは
    • プラグインは何プラグインがインストールされたエラーおよび/または私はPhoneGapのを実行し、真と偽の両方
    • をisTestingで試してみました
    • に仕えていない
    • のPhoneGapプラグインの一覧に表示追加されました
    • devicereadyが実際に発砲していることを確認しました
    • 私のAdmobコードを確認して再確認しました。

    「admob plugin not ready」という警告が常に表示されます。

    「window.plugins.AdMob」という行をAdMob、plugins.Admob、navigator.Admob、window.Admobに変更しようとしました。私はまだこのエラーが発生します。

    私はそのチェック( "if(window.plugins & & window.plugins.AdMob){")をコメントアウトしてコードを実行するだけで何も起こりません。私はコマンドラインにエラーはなく、どこにでも私がデバッグすることができるエラーはありません。ここで

    私のコードです:

    <!DOCTYPE html> 
    <html> 
    <head> 
        <meta charset="utf-8" /> 
        <meta name="format-detection" content="telephone=no" /> 
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 --> 
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> 
        <meta name="msapplication-tap-highlight" content="no" /> 
        <title>Debug Page</title> 
        <style> 
         .bodyStyle{ 
          font-size: 32px; 
         } 
        </style> 
        <script type="text/javascript" charset="utf-8" src="cordova.js"></script> 
    
    </head> 
    <body > 
    <script> 
        function onDeviceReady() { 
         console.log("DEVICE READY"); 
    //initialize the goodies 
    
         if (window.plugins && window.plugins.AdMob) { 
          var ad_units = { 
           ios : { 
            banner: 'ca-app-pub-1631005955280974/1599263468',  //PUT ADMOB ADCODE HERE 
            interstitial: 'ca-app-pub-1631005955280974/6029463060' //PUT ADMOB ADCODE HERE 
           }, 
           android : { 
            banner: 'ca-app-pub-1631005955280974/1599263468',  //PUT ADMOB ADCODE HERE 
            interstitial: 'ca-app-pub-1631005955280974/6029463060' //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, 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(); 
          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 
         }); 
        } 
        function showBannerFunc(){ 
        AdMob.createBannerView(); 
    } 
    //display the interstitial 
    function showInterstitialFunc(){ 
        AdMob.showInterstitialAd(); 
    } 
    
        document.addEventListener("deviceready", onDeviceReady, false); 
    </script> 
    <button type='button' onclick='showBannerFunc();'>SHOW BANNER</button> 
    <br/><br/> 
    <button type='button' onclick='showInterstitialFunc();'>SHOW INTER</button> 
    </body> 
    </html> 
    

    それは

    <plugin name="cordova-plugin-admob-simple" spec="~3.3.3" /> 
    

    などの主要config.xmlに、私は2週間以上、このにされている、私はGoogleで検索し、私のすべてを検索しましたしてくださいされます可能性があります。私は助けを求めて少なくとも100ページを読んでいて、他に何を試していいのか分からないでしょう。私が見つけたものすべて、私は役に立たなかった。何も変わらず、単にあらゆる種類の広告を表示しません。バナーなど。ボタンをクリックしても。お願い助けて。ありがとうございました。

  • 答えて

    0

    私はついにそれを理解しました。私はPhonegap Serveを使っていました。これはプラグイン、または少なくとも第三者のプラグインをサポートしていません。 Phonegapを実行する必要があります。

    0

    私は現在2週間前の段階です。 Admobのプラグインは既にテスト済みですが、広告は表示されません。 残念ながら、apkファイルを生成してモバイルデバイスで実行しても、何も起こりません。 あなたのコードを使用しましたが、「バナーを表示」ボタンを押しても何も表示されません。

    私はダミーID(ca-app-pub-3940256099942544/6300978111)と自分のIDを使用しています。

    たぶん、あなたは私の問題を見て、アドバイスを与えることができます。 Using AdMob and Cordova - ad is not displayed

    を感謝し、

    ピーター

    関連する問題