Created
June 16, 2010 01:23
-
-
Save dasher/439986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this sets the background color of the master UIView (when there are no windows/tab groups on it) | |
Titanium.UI.setBackgroundColor('#000'); | |
// | |
// create root window | |
var win = Titanium.UI.createWindow({ | |
backgroundColor:'#F00', | |
left: 0, | |
top: 0, | |
zIndex: 0 | |
}); | |
// Create an AdProvider - this allows a single provider to be used for multiple ads | |
// AdManager allows you to mix & map different Ad Providers | |
var adProvider = Titanium.AdManager.createProvider({ | |
type: "AdMob", // Extendable - allows dynamic location of new ad providers | |
properties:{ | |
publisherID:'', // Put your publisher ID here from AdMob | |
useLocation:true, | |
devMode: [Titanium.AdManager.AdMob.TEST_EMULATOR, 'something'] | |
} | |
}); | |
// Create the Ad itself | |
var displayAd = adProvider.createAd({ | |
left:0, | |
bottom:5, | |
width:Titanium.Platform.displayCaps.platformWidth, | |
zIndex:1, | |
refreshInterval:30 | |
}); | |
// You can even attach to events - so you know when a new ad is received, failed for some reason, etc | |
displayAd.addEventListener('receiveRefreshAd', function(e){ | |
Titanium.API.info("Event Fired - receiveRefreshAd"); | |
}); | |
// Add it to the window Graph | |
win.add(displayAd); | |
win.open(); | |
setTimeout(function(e){ | |
// Example of setting a property dynamically | |
adProvider.setProperties({devMode:false}); | |
},10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment