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

Java Development

Reply
New Developer
zaeem
Posts: 8
Registered: ‎08-23-2008
My Device: Not Specified
Accepted Solution

ControlledAccessException

I am installing my app through CodeModuleManager.every thing works fine but when my app starts it throws an exception when it reaches app.addGlobalEventListener(app); and the exception is ControlledAccessException. can any one tell me why i am getting this exception
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: ControlledAccessException

Options / Security / Application Permissions, set all to "Allow" and try it again.

 

New Developer
johnnyquest
Posts: 13
Registered: ‎12-13-2008
My Device: Not Specified

Re: ControlledAccessException

I have the same issue with accessing the LED part of the api. I tried setting the permissions to allow everything for my app but I still get the error. I've also tried doing a battery pull after setting the permissions to see if that would make a difference but it didn't. My code works on the simulator (no errors there). I only get this exception when I try to run it on my BlackBerry device. Here's the code that is causing the error:

 

LED.setState(LED.STATE_BLINKING);

LED.setColorConfiguration(LED.LED_TYPE_STATUS,90,70,0x00990000); 

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: ControlledAccessException

Is your code signed?

 

What line is throwing the exception?

 

What device are you running on, and what is the OS level?

New Developer
johnnyquest
Posts: 13
Registered: ‎12-13-2008
My Device: Not Specified

Re: ControlledAccessException

No, my code is not signed, but, when I compile and check the "Request Signatures" screen, it tells me that I don't have any code which requires signing. Also, the LED class in the api doesn't show the lock icon which I was led to believe is what you see in the parts of the api that requires signing. Is that not the case? I'm new to BB development so I honestly don't know. Any help you could offer would be greatly appreciated.

 

I'm running on the 8330 simulator and my actual device is an 8330 as well. My OS version is 4.5 (4.5.0.77).

 

This is the code:

 

LED.setState(LED.STATE_BLINKING);

LED.setColorConfiguration(LED.LED_TYPE_STATUS,90,70,0x00990000);    // <-- this line is throwing the exception

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: ControlledAccessException

A ControlledAccessException relates to application permissions, not code signing.

 

Have you created a MIDlet or BlackBerry CLDC application?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
johnnyquest
Posts: 13
Registered: ‎12-13-2008
My Device: Not Specified

Re: ControlledAccessException

It's a CLDC application. It's basically a hello world application that tries to set the LED light on:

 

public HelloWorldMainScreen() {

super();

 

net.rim.device.api.ui.component.LabelField appTitle = new 

net.rim.device.api.ui.component.LabelField("Hello World");

 

setTitle(appTitle);

 

this.add(new LabelField("My Test Mood"));

 

 

LED.setState(LED.STATE_BLINKING);

         LED.setColorConfiguration(LED.LED_TYPE_STATUS,9,7,0x00990000);

 

 

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: ControlledAccessException

[ Edited ]

Here is a code snippet that works:

 

// if we have a polychromatic LED, we'll attempt to // set to the user-selected color if (LED.isPolychromatic()){ // blink in the selected color (if possible) LED.setColorConfiguration(ON_TIME,OFF_TIME,alert.getLEDColor()); } // otherwise, just blink the darn thing else { //start the LED blinking LED.setConfiguration(ON_TIME,OFF_TIME, LED.BRIGHTNESS_50); LED.setState(LED.STATE_BLINKING); }

 

 

Note the sequence of events.

Message Edited by RexDoug on 12-15-2008 03:12 PM
New Developer
johnnyquest
Posts: 13
Registered: ‎12-13-2008
My Device: Not Specified

Re: ControlledAccessException

That worked!! Thanks so much. So, I guess it was the order of operation which was causing it to break which is interesting, because it worked in the simulator the original way I had it, but only broke when loading to the actual device. Thanks again. Much appreciated!
Developer
aryan777
Posts: 76
Registered: ‎02-21-2009
My Device: Not Specified

Re: ControlledAccessException

I have a similar problem and your suggestion seems to be the solution for it but unfortunately it doesnot work exactly as desired. Following is the problem description:

 

Device    - 8100

Device os- 4.5

Build environment - I tried both 4.2.1 and 4.5.0

 

Problem piece of code:

LED.setState(LED.LED_TYPE_TRACKBALL,LED.STATE_ON);
LED.setColorConfiguration(1000,0,colourHex);

 

This changes the status LED colour instead of the Trackball colour as i expect. The trackball seems to brighten up as this piece is executed and looks the same regardless of the colourHex. I installed another third party software and the colouring works fine there. Am I missing something here?