如何通过Phonegap构建器在经过认证的应用中显示admob广告?

时间:2019-01-03 17:33:45

标签: android admob keystore phonegap

我已经通过phonegap生成器通过HTML5,JS,CSS,PHP和MySQL开发了应用程序。我已经在我的应用程序中成功使用了admob插件,但是当我在phonegap生成器上向我的应用程序添加密钥库时,经过认证的应用程序中没有广告。下面是我的config.xml插件代码

<plugin name="cordova-plugin-admobpro" spec ="~2.35.3" source="npm" >
        <variable name="PLAY_SERVICES_VERSION" value="16.0.0" />
</plugin>

下面是JS代码。当我打开没有密钥库的apk时,一切正常。

var admobid = {};
if( /(android)/i.test(navigator.userAgent) ) { 
    admobid = { // for Android
        banner: 'ca-app-pub-3620418953743637/6097985822',
        interstitial: 'ca-app-pub-3620418953743637/2453242527',
        rewardvideo: 'ca-app-pub-3620418953743637/6437036798'
    };
} 



function initApp() {
var oyunSonu = localStorage.getItem("oyunSonu");
$('#reklamKont').fadeIn();

if(oyunSonu != "1"){
      $('#reklamKont').fadeOut();
}

AdMob.prepareInterstitial({
    adId: admobid.interstitial,
    autoShow: false
});

        AdMob.prepareRewardVideoAd({
        adId:admobid.rewardvideo,
        autoShow: false,
      });


}

document.addEventListener('deviceready', initApp, false);
//////////////////////////////////////////////////////////////////


function odulReklamFNC(){

if(odulTusAktif == 1)
{
    AdMob.showRewardVideoAd();
    odulTusAktif = 0;


}
}


var odulTusAktif;
document.addEventListener('onAdLoaded',function(data){ 

if(data.adType == 'interstitial'){
    var oyunSonu = localStorage.getItem("oyunSonu");
    if(oyunSonu == "1"){
        localStorage.setItem('oyunSonu', '0');
        $('#reklamKont').fadeOut();
        AdMob.showInterstitial();
        }
}

 if(data.adType == 'rewardvideo'){
        odulTusAktif = 1;
        if(odulBTNGoster == 1){
        $('#odulBTN').fadeIn();
        }



        }

//
});


document.addEventListener('onAdPresent', function(data){ 

        if(data.adType == 'rewardvideo'){


            var uyeCookie = localStorage.getItem("uyeID"); 

            $.ajax({
            type: "GET",
            url: websitePHP + "odulVer.php",
            data: {
                id : uyeCookie

                },
                beforeSend: function(){ 

            $("#phpKont").fadeIn();
            },
            success: function(gelenVeri){ 
            $("#phpKont").fadeOut();
            $('#odulBilgi').html(gelenVeri);
            $("#gunlukPrim").fadeOut();
            $("#odulBildiri").fadeIn();
            document.getElementById('satinAlSES').currentTime = 0;
            document.getElementById('satinAlSES').play();
            odulBTNGoster = 0;
            girisAnaFNC();
            top10FNC();


        }

    })


        //$('#rumuz').html(data.rewardType);
        //$('#elmas').html(data.rewardAmount);
        }

});



document.addEventListener('onAdFailLoaded',function(data){ 
        if(data.adType == 'interstitial'){
        localStorage.setItem('oyunSonu', '0');
        $('#reklamKont').fadeOut();
        }

        if(data.adType == 'rewardvideo'){

        }

    });

    document.addEventListener('onAdDismiss',function(data){ 


        if(data.adType == 'rewardvideo'){
            if(odulBTNGoster != 0){
            window.open('baslangic.html','_self');

            }

        }

    });

如何解决此问题。我也担心将我的应用程序上传到Google Play服务时会发生这种情况。

谢谢。

0 个答案:

没有答案