Advertising
Has anyone else got advertising working on Ti Mobile?
5 Answers
-
I saw somewhere that that feature is comming soon for now, you can create a WebView and rotate adverts from there.
-
Tried this but AdMob only works in test mode.
-
Well I wrote my own advertising script here you go free to try it out.
if (Ti.App.Properties.getString("adverts") == null) {
Ti.App.Properties.setString("adverts",1);
}var ads = Titanium.UI.createButton({
color:'#fff',
backgroundImage:'../adverts/advert'+Ti.App.Properties.getString("adverts")+'.png',
bottom:0,
width:320,
height:40
});ads.addEventListener('click', function()
{if (Ti.App.Properties.getString("adverts") == 1){
var winc = Titanium.UI.createWindow({
title:'Sponser 1',
backgroundColor:'#fff',
textAlign:'right',
barColor:'#000'
});var webview = Ti.UI.createWebView(); webview.url = 'http://yahoo.com'; winc.add(webview); Titanium.UI.currentWindow.tab.open(winc);
}
if (Ti.App.Properties.getString("adverts") == 2){
var winc = Titanium.UI.createWindow({
title:'Sponser 2',
backgroundColor:'#fff',
textAlign:'right',
barColor:'#000'
});var webview = Ti.UI.createWebView(); webview.url = 'http://google.com'; winc.add(webview); Titanium.UI.currentWindow.tab.open(winc);
}
if (Ti.App.Properties.getString("adverts") == 3){
var winc = Titanium.UI.createWindow({
title:'Sponser 3',
backgroundColor:'#fff',
textAlign:'right',
barColor:'#000'
});var webview = Ti.UI.createWebView(); webview.url = 'http://wikipedia.org'; winc.add(webview); Titanium.UI.currentWindow.tab.open(winc);
}
var totads = Math.abs(Ti.App.Properties.getString("adverts")) + (1);
Ti.App.Properties.setString("adverts",totads);
if (Ti.App.Properties.getString("adverts") == 4){
Ti.App.Properties.setString("adverts",1);}
//new
ads.backgroundImage ='../adverts/advert'+Ti.App.Properties.getString("adverts")+'.png';
});Titanium.UI.currentWindow.add(ads);
//Ensure you name your adverts like advert1.png,adver2.png and so on. -
We'll be announcing some in application advertising options very soon.
-
Has anyone found a solution for this?
The problem I am having is this:
I create a webView that's 50 pixels tall which pulls in a file containing Google AdSense. This renders fine, and I can click the link. (Note: I haven't tested with real adsense, but I am using an iframe which mimicks the adsense code).
But, now the page is loaded in the webView with a height of 50 pixels.
I don't know how to make the webview have height: 100% at this point. I have tried addEventListener but it always overrides the click event.