Closed gaom25 closed 6 years ago
The deprecations are not a problem. When you set isTesting = true do you see ads?
I tried to set 'isTesting = true' but now the message of "Device is ready" doesn't show. this is my code `var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
app.receivedEvent('deviceready');
console.log("DEVICE READY");
},
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
initAd();
showBannerFunc();
showInterstitialFunc();
console.log('Received Event: ' + id);
}
};
function initAd(){
if ( window.plugins && window.plugins.AdMob ) {
var ad_units = {
ios : {
banner: 'ca-app-pub-4789158063632032/7680949608', //PUT ADMOB ADCODE HERE
interstitial: 'ca-app-pub-4789158063632032/4587882405' //PUT ADMOB ADCODE HERE
},
android : {
banner: 'ca-app-pub-4789158063632032/7680949608', //PUT ADMOB ADCODE HERE
interstitial: 'ca-app-pub-4789158063632032/4587882405' //PUT ADMOB ADCODE HERE
}
};
var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;
window.plugins.AdMob.setOptions( {
publisherId: admobid.banner,
interstitialAdId: admobid.interstitial,
adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER, //use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
bannerAtTop: false, // set to true, to put banner at top
overlap: true, // banner will overlap webview
offsetTopBar: false, // set to true to avoid ios7 status bar overlap
isTesting: false, // receiving test ad
autoShow: true // auto show interstitial ad when loaded
});
registerAdEvents();
} else {
alert( 'admob plugin not ready' );
}
}
function registerAdEvents() {
document.addEventListener('onReceiveAd', function(){});
document.addEventListener('onFailedToReceiveAd', function(data){});
document.addEventListener('onPresentAd', function(){});
document.addEventListener('onDismissAd', function(){ });
document.addEventListener('onLeaveToAd', function(){ });
document.addEventListener('onReceiveInterstitialAd', function(){ });
document.addEventListener('onPresentInterstitialAd', function(){ });
document.addEventListener('onDismissInterstitialAd', function(){ });
}
function showBannerFunc(){
window.plugins.AdMob.createBannerView();
}
function showInterstitialFunc(){
window.plugins.AdMob.createInterstitialView();
window.plugins.AdMob.requestInterstitialAd();
}
app.initialize();`
After setting it to true the device ready stops showing? Is that the only change you make?
I set it to true and change the emulate device form iPhone 5 to iPhone 6s Plus, but the mob still not showing neither banner nor Interstitial.
This is the log from xcode
2017-02-13 12:57:56.797 HalloWorld[26927:317689] Apache Cordova native platform version 4.1.1 is starting. 2017-02-13 12:57:56.798 HalloWorld[26927:317689] Multi-tasking -> Device: YES, App: YES 2017-02-13 12:57:56.832 HalloWorld[26927:317689]
Started backup to iCloud! Please be careful. Your application might be rejected by Apple if you store too much data. For more information please read "iOS Data Storage Guidelines" at: https://developer.apple.com/icloud/documentation/data-storage/ To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
2017-02-13 12:57:56.948 HalloWorld[26927:317689] Using UIWebView 2017-02-13 12:57:56.949 HalloWorld[26927:317689] [CDVTimer][handleopenurl] 0.143051ms 2017-02-13 12:57:56.951 HalloWorld[26927:317689] [CDVTimer][intentandnavigationfilter] 1.946986ms 2017-02-13 12:57:56.952 HalloWorld[26927:317689] [CDVTimer][gesturehandler] 0.093043ms 2017-02-13 12:57:56.952 HalloWorld[26927:317689] [CDVTimer][TotalPluginStartup] 2.843976ms 2017-02-13 12:57:57.165 HalloWorld[26927:317689] Resetting plugins due to page load. 2017-02-13 12:57:57.587 HalloWorld[26927:317689] Finished load of: file:///Users/Gustavo/Library/Developer/CoreSimulator/Devices/94CE1926-3042-4D76-AD55-48BAADD491D1/data/Containers/Bundle/Application/21AE59B0-7D67-44C3-91DB-C701E6871412/HalloWorld.app/www/index.html
I try to add the plugin to both iOS and Android, for Android there was no problem but for iOS the banner and the Interstitial didn't show, there was some warnings like:
I don't know if this warnings are the problem.
I am using: