This question is locked. New answers and comments are not allowed.
HI i have added admob in my app and its not showing any ads this is ads.js code
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
// Update DOM on a Received Event
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;');
console.log('Received Event: ' + id);
if( window.AdMob ) {
var adIdiOS = 'ca-app-pub-1241252919825525/1505824893';
var adIdAndroid = 'ca-app-pub-1241252919825525/1505824893';
var adId = (navigator.userAgent.indexOf('Android') >=0) ? adIdAndroid : adIdiOS;
var am = window.AdMob;
am.createBannerView(
{
'publisherId' : adId,
'adSize' : am.AD_SIZE.BANNER,
'bannerAtTop' : true
},
function() {
am.requestAd({
'isTesting' : true,
'extras' : {
'color_bg' : 'AAAAFF',
'color_bg_top' : 'FFFFFF',
'color_border' : 'FFFFFF',
'color_link' : '000080',
'color_text' : '808080',
'color_url' : '008000'
}},
function() {},
function() {
alert('Error requesting Ad');
});
},
function() {
alert('Error create Ad Banner');
}
);
} else {
alert( 'AdMob plugin not loaded.' );
}
}
};
and initialization
<script type="text/javascript">
app.initialize();
</script> but still it does not show any ads in simulator or in my mobile. Can anyone help me.
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
// Update DOM on a Received Event
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;');
console.log('Received Event: ' + id);
if( window.AdMob ) {
var adIdiOS = 'ca-app-pub-1241252919825525/1505824893';
var adIdAndroid = 'ca-app-pub-1241252919825525/1505824893';
var adId = (navigator.userAgent.indexOf('Android') >=0) ? adIdAndroid : adIdiOS;
var am = window.AdMob;
am.createBannerView(
{
'publisherId' : adId,
'adSize' : am.AD_SIZE.BANNER,
'bannerAtTop' : true
},
function() {
am.requestAd({
'isTesting' : true,
'extras' : {
'color_bg' : 'AAAAFF',
'color_bg_top' : 'FFFFFF',
'color_border' : 'FFFFFF',
'color_link' : '000080',
'color_text' : '808080',
'color_url' : '008000'
}},
function() {},
function() {
alert('Error requesting Ad');
});
},
function() {
alert('Error create Ad Banner');
}
);
} else {
alert( 'AdMob plugin not loaded.' );
}
}
};
and initialization
<script type="text/javascript">
app.initialize();
</script> but still it does not show any ads in simulator or in my mobile. Can anyone help me.