This page will demonstrate how to make use of Corona SDK Banner Ad support. Banner Ads are used to display advertisements within your app, to provide you with another optional income stream (see also: in-app purchases and offer-based virtual currency).
For an example of basic Banner Ads integration, see the SampleCode folder in the Corona SDK release download (In the “BannerAds” folder). To see banners in that example, you'll need to activate your user account with InMobi and get your own app Id by going to http://www.inmobi.com/url/registration-form/ and filling out your information.
The following line makes Banner Ads features available under the "ads" namespace:
ads = require "ads"
ads.init( providerName, appId )
The above line is required to initialize the banner ads library for further use in your app. providerName is a string representing the ad network you wish to use. appId is your unique app Id you'll get from the network's website for use with your app.
ads.show( adUnitType [, params] )
The show() function is used to display an actual banner ad. There are currently five different ad unit types you can show. Below is a listing of the different adUnitTypes you can pass:
params
This argument is optional, and is used to set some initial settings for the ad unit. Below is a listing of the different parameters you can pass:
x - number. the starting x-coordinate of the banner unit (from top-left reference point).
y - number. the starting y-coordinate of the banner unit (from top-left reference point).
interval - number. the amount of seconds you want each ad to show before switching to the next.
testMode - boolean (true/false). set this to true if you are still developing your app. set it to false for distribution.
ads.hide()
The above line will hide all ads that are currently showing.
local ads = require "ads" -- Example for inmobi: ads.init( "inmobi", "12345abc6789defghijk123" ) -- iPhone, iPod touch, iPad ads.show( "banner320x48", { x=0, y=100, interval=5, testMode=false } ) ads.show( "banner300x250", { x=0, y=100, interval=5, testMode=false } ) -- The following are iPad only ads.show( "banner728x90", { x=0, y=100, interval=5, testMode=false } ) ads.show( "banner468x60", { x=0, y=100, interval=5, testMode=false } ) ads.show( "banner120x600", { x=0, y=100, interval=5, testMode=false } )
Refer to the guide below for steps on how to get a unique app Id for your project (each app must have its own unique app Id).
Supported Ad Networks
STEP ONE
Visit the InMobi registration page to get a new account. Fill out your information as you see in the screenshot below:

STEP TWO
Upon successful registration, you will be told to check your email to click on a confirmation link:

STEP THREE
Check your email and click the confirmation link that was sent to you. Once you click the link, you will be presented with the InMobi login screen. Registration is complete:

Follow the steps below to get a new app Id. You will need a unique app Id for every project you wish to implement Banner Ads.
STEP ONE
Log into your InMobi account. Once you are logged in, click on My Sites/Apps on the left (as shown below).

STEP TWO
Click on Register New Site/App and a drop-down will appear. Choose Android or iOS depending on your target platform.

STEP THREE
Enter the information for your app and click Continue at the bottom.

STEP FOUR
You will then be presented with your unique app Id. Make note of it, because you will need to use it within your Corona project.

NOTE: You may have to wait for your app to be approved by InMobi administrators before banner ads show up in your app (there is a possibility banners could show up before then).