Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Advertising Service

by BlackBerry Development Advisor on ‎09-27-2010 06:25 PM (14,334 Views)

The BlackBerry Advertising Service allows you to easily integrate banner ads into your application.  I’m going to put together a quick sample application to show you just how easy it is.  First, I’ll start with a basic class that creates a screen and pushes it onto the display stack.



import net.rim.blackberry.api.advertising.app.Banner;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;

 * A simple sample application that demonstrates the use of the banner class
 * from the Advertisement SDK. A sample Application Placement ID is used to
 * demonstrate the simplicity of the API.
final class AdSample extends UiApplication

     * This is an Application ID (APID) that is used solely for demonstration
     * purposes.  For your application you will need to use the one that will be assigned to you after registration.
    private static final int APID = 0;
    public static void main(String[] args)
        AdSample app = new AdSample();

    public AdSample()
        DemonstrationScreen demoScreen = new DemonstrationScreen();

    private class DemonstrationScreen extends MainScreen
	//Ad code goes here



Now that we have our simple application it’s time to our banner advertisement.  Let’s place a banner ad into the DemonstrationScreen screen using its constructor:



  public DemonstrationScreen()
  //Create a banner object by passing it the demo application placement ID and null since we don’t have any meta data to pass.
            Banner bannerAd = new Banner(AdSample.APID, null);
            //Sets the size of the banner ad that specified in the bannerSize integer value.
            //Adds the banner ad to the screen


That’s it! All the networking and rendering functionality is handled by the banner class so all that you are required to do is place it.

by New Developer on ‎12-28-2010 03:22 AM

Hi, where do the ads come from?  Does RIM take care of the ads?

by Retired on ‎01-04-2011 10:51 AM

RIM provides the ads via Millennial Media's aggregation network which includes multiple advertising sources.

Users Online
Currently online: 58 members 2,164 guests
Please welcome our newest community members: