0

我用的是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 插件,并在控制台上启用了订阅,我该如何测试呢

谢谢

4

1 回答 1

0

我使用 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>

还要检查参考。 使用 cordova 进行 InApp 购买

于 2018-02-27T15:47:22.750 回答