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.

inside custom component

BlackBerry Advertising Service

Reply
Contributor
coffeesam
Posts: 13
Registered: ‎04-01-2012
My Device: blackberry torch 2
My Carrier: at&t

banner causing error

Hello,

 

when I add the following code for putting a banner on my app, the simulator doesn't start up, and i don't see any exceptions. lines 1, and 2 don't cause any issues bu when I add the banner then it doesn't work (on Sim or Phone)

 

1. Banner bannerAd = new Banner(00000, null);
2. bannerAd.setMMASize(Banner.MMA_SIZE_EXTRA_LARGE);

3. add(bannerAd);

 

Thank You

Sam

 

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: banner causing error

Hi Sam and welcome to the forums!

 

Could you elaborate on "the simulator doesn't start up"? What does the simulator do? Does it launch? If so, how far does it get? 

What are you adding the Banner to (MainScreen etc)?

Could you provide a bigger snippet of code (surrounding code would be helpful)?

 

Regards,

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
coffeesam
Posts: 13
Registered: ‎04-01-2012
My Device: blackberry torch 2
My Carrier: at&t

Re: banner causing error

Hi Garrett,

 

the issue with the simulator, in the part when the OS is booting up (and it says blackberry in the middle with the loading bar in the middle) the loading bar doesn't get to 100% then the screen goes white saying there was a uncaught exception. so i don't even get to the home screen. 

 

i am add the banner to the mainscreen.

 

Here is a larger postion of the code, i add the banner code in the bottom portion and the advertising JAR i imported was For_Post6.0.0:

 

private VerticalFieldManager vfm = new VerticalFieldManager(Field.FIELD_VCENTER);
private VerticalFieldManager vfm2 = new VerticalFieldManager(Field.FIELD_VCENTER);
private HorizontalFieldManager bannerField = new HorizontalFieldManager(Field.FIELD_HCENTER);

 

public FunReadsScreen()

{

super( MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR );
setTitle( "title" );

BitmapField bitmapField;
Bitmap logoBitmap = Bitmap.getBitmapResource("pic.png");
bitmapField = new BitmapField(logoBitmap, Field.FIELD_HCENTER);

add(bitmapField);

Background bg = BackgroundFactory.createSolidBackground(Color.BLACK);


vfm.setPadding(15, 0, 10, 150);
vfm2.setPadding(0, 0, 10, 75);
vfm.setBackground(bg);
vfm2.setBackground(bg);
getMainManager().setBackground(bg);

ButtonField button1 = new ButtonField( "btn1", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER);
ButtonField button2 = new ButtonField("btn2", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER);
ButtonField button3 = new ButtonField("btn3", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER);

vfm.add(button1);
vfm.add(button2);
vfm2.add(button3);

add(vfm);
add(vfm2);

Banner bannerAd = new Banner(myZoneID, null);
bannerAd.setMMASize(Banner.MMA_SIZE_EXTRA_LARGE);
bannerField.add(bannerAd);
add(bannerField);

}

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: banner causing error

Thanks fore the code snippet but I forgot to ask for one crucial bit of information, could you provide the simulator model and OS version (Options > Device > About Device Versions)?

 

After I get this I can repro myself and hopefully offer some sort og workaround or fix for the issue.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
coffeesam
Posts: 13
Registered: ‎04-01-2012
My Device: blackberry torch 2
My Carrier: at&t

Re: banner causing error

Hi Garett,

 

so the simulator i am using is the BlackBerry 9800, running O/S version v6.0.0.141

 

and the physical device i tried it on was the Blackberry 9810, running O/S version v7.0.0.583

 

Thanks

Sam

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: banner causing error

Hi Sam,

 

I tested in the 9800 6.0.0.141 simulator using the code snippet provided and was unable to reproduce the issue, it loaded the ad as expected. Could you please log an issue in Issue Tracker with a small and concise sample application that has been proven to reproduce this issue?

https://www.blackberry.com/jira/secure/Dashboard.jspa

 

You can post the Issue Tracker item URL back here and I will continue to investigate through it.

 

Regards,

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
coffeesam
Posts: 13
Registered: ‎04-01-2012
My Device: blackberry torch 2
My Carrier: at&t

Re: banner causing error

Thank You Garrett I'll do that,

 

I was going thorugh the debugger with a little more detail and saw this message as an IOException

 

Thread [appName(237)id=IDnumber] (Suspended (exception IOException)) :
ClientProtocol(ClientProtocol).handleIOExceptionBeforeResponse(IOException) line: 298
ClientProtocol(ClientProtocol).ensureOpen() line: 176
ClientProtocol(ClientProtocol).<init>(SocketHost, URL, boolean, boolean, boolean, boolean, WPTCPServiceRecord, ServiceRecord) line: 136
Protocol.doConnection(URL, int, boolean) line: 116
Protocol.openConnection(URL, int, boolean) line: 55
Protocol.openPrim(URL, int, boolean) line: 67
Protocol.openPrim(String, int, boolean) line: 59
RIMConnector.open(int, String, int, boolean, FirewallContext) line: 239
RIMConnector.open(int, String, int, boolean) line: 58
Connector.open(String) line: 831
Banner$FunReads.d() line: not available
Banner$FunReads.a() line: not available
a.run() line: not available

ClientProtocol(ClientProtocol).handleIOExceptionBeforeResponse(IOException) line: 298
ClientProtocol(ClientProtocol).ensureOpen() line: 176
ClientProtocol(ClientProtocol).<init>(SocketHost, URL, boolean, boolean, boolean, boolean, WPTCPServiceRecord, ServiceRecord) line: 136
Protocol.doConnection(URL, int, boolean) line: 116
Protocol.openConnection(URL, int, boolean) line: 55
Protocol.openPrim(URL, int, boolean) line: 67
Protocol.openPrim(String, int, boolean) line: 59
RIMConnector.open(int, String, int, boolean, FirewallContext) line: 239
RIMConnector.open(int, String, int, boolean) line: 58
Connector.open(String) line: 831
Banner$appName.d() line: not available
Banner$appName.a() line: not available
a.run() line: not available

 

 

does any of this look familiar to you?

 

Thanks

Sam

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: banner causing error

I'll know more once logged in Issue Tracer with a sample.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
coffeesam
Posts: 13
Registered: ‎04-01-2012
My Device: blackberry torch 2
My Carrier: at&t

Re: banner causing error

for some reason and i don't know why, the ads started working. I had step away from it for a little while cause i didn't have time but when i ran it the other day it started working haha. oh well, on to the next issue then :smileyhappy: 

 

Thanks for your help!

Please use plain text.