[英]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);
} })
我將fovea插件用於PhoneGap,並在控制台上啟用了訂閱功能,我如何也對此進行測試
謝謝
我使用了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購買
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.