Created
June 30, 2017 12:26
-
-
Save 1fabiopereira/77c5cb2f3a4b27550459d3c557259df0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var Admob = require('ti.admob'); | |
var InLoco = require('com.inlocomedia.appcelerator'); | |
var admob; | |
var callbackInterstitial; | |
// Função é chamada toda vez que um banner tiver de ser aberto | |
function showInterstitialAds(callback) { | |
callbackInterstitial = callback || function () {}; | |
if (OS_IOS) { | |
//Inicialização da Inloco SDK | |
InLoco.initWithOptions({ | |
appId : 'App_Id', | |
logsEnabled : true, //true will show the In Loco Media SDK logs | |
developmentEnvironment : true //Set to true for development | |
}); | |
admob = require('ti.admob').createView({ | |
width: 0.1, | |
height: 0.1, | |
adType: require('ti.admob').AD_TYPE_INTERSTITIAL, | |
adUnitId: 'iOs_Interstitial_ID' | |
}); | |
admob.requestAd(); | |
admob.addEventListener('didReceiveAd', function () { | |
$.mainWindow.add(admob); | |
}); | |
} else { | |
if (!admob) admob = require('ti.admob'); | |
admob.showInterstitial({ adUnitId: 'Android_Interstitial_ID' }); | |
} | |
callbackInterstitial(); | |
} | |
// Saida do console: | |
// [INFO] : In Loco Media SDK module loaded | |
// [INFO] : AdMob module loaded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment