如何在 PhoneGap android 应用程序中取消显示订阅广告

How to unshow Ads on subscription in PhoneGap android app

我用的是Appodeal sdk,AdMob也是一样的原理

在付费版中,当用户订阅时, 如何检查用户实际付款,返回布尔值 true 或 false。

有了这个结果,我想取消向此类用户显示 Appodeal 的代码。 处理这个问题的最佳方法是什么?使用 javascript?

> function onDeviceReady() {
> 
>   var test ;
>   var appKey = "...";
>     
    if (test) {

>      document.removeEventListener('deviceready', onDeviceReady, false);
> 
>     Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false);
>     Appodeal.initialize(appKey, Appodeal.INTERSTITIAL);
>     Appodeal.cache(Appodeal.INTERSTITIAL);
>     Appodeal.enableInterstitialCallbacks(true);
>       
>          document.addEventListener('onInterstitialLoaded', function(){
> 
>     Appodeal.show(Appodeal.BANNER_BOTTOM); 
> 
>    //after init
> 
>   Appodeal.isLoaded(Appodeal.INTERSTITIAL, function(result){
>     if (result == true)
>     Appodeal.show(Appodeal.INTERSTITIAL);   

} })

我使用了 PhoneGap 的 fovea 插件,并在控制台上启用了订阅,我该如何测试它

谢谢

我使用 disableADS() 函数为订阅用户隐藏广告

  store.when("id subscribe").owned(function() {                  
     console.log("PRODUCT PURCHASED");                  
     alert('You purchased the ad-free version! Please restart the application to finish.');                 
     disableADS(); // custom function triggered          
    });                   // After we've done our setup, we tell the store to do         
    // it's first refresh. Nothing will happen if we do not call store.refresh()                
   store.refresh();            
   }

  function buyADS(){   
     store.order('id subscribe');
    }
  function disableADS(){
    flag=true;
  }
</script>



<script type="text/javascript"> 
 function onDeviceReady() {

   var appKey = "12345";
      if (!flag) {

  document.removeEventListener('deviceready', onDeviceReady, false);

 Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false);
 Appodeal.initialize(appKey, Appodeal.INTERSTITIAL);
 Appodeal.cache(Appodeal.INTERSTITIAL);
 Appodeal.enableInterstitialCallbacks(true);

document.addEventListener('onInterstitialLoaded', function(){

 Appodeal.show(Appodeal.BANNER_BOTTOM); 

 Appodeal.isLoaded(Appodeal.INTERSTITIAL, function(result){
 if (result == true)
 Appodeal.show(Appodeal.INTERSTITIAL); 
}}
)}
</script>

同时检查参考资料。 InApp purchases with cordova