Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

BlackBerry Advertising Service

Reply
Developer
silver20
Posts: 453
Registered: ‎03-04-2011

Keep banner object ready while hidden?

My app is entirely based on pop-ups (the app has no MainScreen and is in the background most of the time), so if a new banner is created for every pop-up, not only may there not be time to load an ad, but I don't want there to be lags every time a dialog comes up.

 

So, I'd like to create a banner object on the 1st pop-up, show it, then keep a reference to that object for subsequent pop-ups.  If there wasn't time for an ad to load during the 1st dialog, I want it to load up in the background and be ready for future pop-ups.

 

Can a banner object work that way?  Basically I want it created, filled, and ready, and then it can be exposed and obscured without having to be recreated or load new content every time it pops back up.

 

If it has to be added to a Manager for its entire lifetime, then I can keep a reference to its Manager, but when the user closes each dialog, that Manager will be removed from the PopupScreen and kept to be re-added to the next PopupScreen.

 

If this can't work it will mean I can't use BB ad service with this particular app, so I'm checking in advance.

 

thanks...!

 

Please use plain text.
Contributor
emmanix2002
Posts: 11
Registered: ‎10-06-2010
My Carrier: mtn

Re: Keep banner object ready while hidden?

Hi, if you study the PDF docs that came along with the BB Adservices SDK, you'll notice the answers to a couple of questions you asked. I'll summarise them on a per point basis:

  1. "Can a banner object work that way?  Basically I want it created, filled, and ready, and then it can be exposed and obscured without having to be recreated or load new content every time it pops back up" - In this case I'd say a yes since it's the same banner object in the same container that is brought to the foreground or moved to the background but i believe  that a banner will only load data (ads) when it's in the foreground
  2. "If it has to be added to a Manager for its entire lifetime, then I can keep a reference to its Manager, but when the user closes each dialog, that Manager will be removed from the PopupScreen and kept to be re-added to the next PopupScreen" -- In this case the answer will be NO! According to the documentation, if you're to use multiple banner objects in your app, make sure you dont use the same banner object reference on more that one screen object, else it might behave in unpredictable ways, so the best thing to do (or rather how i implemented it in my app) is:
    1. Create an Array object to hold your banner objects (say for instance you expect 3 Pop=Ups at most) create a Banner array for 3 items; Banner[] _popupBanners = new Banner[3];
    2. In a single method, instantiate each element of the array to a valid Banner object; 
      for(int i=0; i<_popupBanners.length; i++){
      _popupBanners[i] = new Banner(zoneId,null);
      _popupBanners..setMMASize(Banner.MMA_SIZE_EXTRA_LARGE);
      }
    3. For each popup screen in your app, assigns an _adIndex (a value between 0 and 2 i.e. the indices in your banner array); for each of these screens, add the appropriate banner object to the required position on the screen & the banner should take care of itself from there.
      add(_popupBanners[_adIndex]); 

Anyways, those are my thoughts. Best of luck in whatever way you settle to solve your specific needs. :smileyhappy:

 
Please use plain text.
Developer
silver20
Posts: 453
Registered: ‎03-04-2011

Re: Keep banner object ready while hidden?

Thanks, here's the caveat in this case-- I'll have a lot of frequent pop-ups, sometimes in quick succession. Maybe I can use just one screen that's never destroyed (just popped and kept, then re-pushed) for all of those pop-ups, just changing the contents except for the banner.

I'm presuming that the Banner knows when it's obscured and exposed and will not go on loading new content and counting "impressions" while the screen is popped and dormant.

Time to start trying it I guess...

Thx
Please use plain text.