Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Advertising

Has anyone else got advertising working on Ti Mobile?

— asked March 21st 2010 by Toby Hughes
  • ads
0 Comments

5 Answers

  • I saw somewhere that that feature is comming soon for now, you can create a WebView and rotate adverts from there.

    — answered March 21st 2010 by scott castov
    permalink
    0 Comments
  • Tried this but AdMob only works in test mode.

    — answered March 21st 2010 by Toby Hughes
    permalink
    0 Comments
  • 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.

    — answered March 21st 2010 by scott castov
    permalink
    0 Comments
  • We'll be announcing some in application advertising options very soon.

    — answered March 21st 2010 by Jeff Haynie
    permalink
    0 Comments
  • 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.

    — answered April 6th 2010 by Alex Grande
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.