Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Showing one ad (iAd or Admob) at least all the time

$
0
0

Hi

This is not a question.This is about the problem that that i have faced in last days while integrating ads.I have used both iAd and admob in my app so both lack some features like iAd is not being shown in all countries but it gives a good return so i thought to make a code that shows one ad at least at a time.Here is my code for that.

var Admob = require('ti.admob');
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
 
var admobView = Admob.createView({
bottom : 0,
width : 320,
height : 50,
adUnitId : '*************************', // You can get your own at http: //www.admob.com/
adBackgroundColor : 'black',
dateOfBirth : new Date(2008, 10, 1, 12, 1, 1),
});
win.add(admobView);
var iAd = Ti.UI.iOS.createAdView({
bottom : 0,
height : 50,
width : 320,
zIndex : 1
});
win.add(iAd);
iAd.addEventListener('error', function(e) {
iAd.hide();
});
iAd.addEventListener('load', function() {
iAd.show();
});
iAd.hide();
win.open();
Have a also a code on github here

https://github.com/Wahhab-Mirza/Titanium-Ad-Techinque

Maybe it helps somebody

Thanks


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>