03-19-2009 05:20 PM
I've added a global event listener to my UiApplication. On most devices I've tested on, it works well. However, it was just brought to my attention that the call to addGlobalEventListener sometimes throws a ControlledAccessException. I know this means my application requires an additional permission, but it's unclear which one I need. I'm using ApplicationPermissionsManager at startup to request other permissions and I'd like to do the same for whatever permission I need for addGlobalEventListener. None of the constants in ApplicationPermissions sound like what I want. Any ideas?
Solved! Go to Solution.
03-26-2009 10:13 AM
03-26-2009 10:19 AM
09-22-2009 07:56 PM
We are also facing similar issue with our application and its built using JDE 4_21. I could not find any classes related to ApplicationPermissions in 4_21 library.
And more over this happens on few devices (9630 Tour and Curve) and only sometimes. I was wondering why would this happen on few devices and only sometimes. Is it something to do with OS and device?
How can fix this issue? Your help is great;y appreciated.
guid:0x9C3CD62E3320B498 time: Thu Sep 17 17:15:57 2009 severity:1 type:3 app:Java Exception data:
ControlledAccessException
No detail message
net_rim_cldc-16(4A42F4E8)
ApplicationControlImpl
assertIPCAllowed
0x2D1A
net_rim_cldc-16(4A42F4E8)
ApplicationControl
assertIPCAllowed
0x129B
net_rim_cldc-6(4A42F4E8)
Application
addGlobalEventListener
0x1852
09-22-2009 08:03 PM
Minor correction.
I do see ApplicationPermissions class but dont see constant PERMISSION_DEVICE_SETTINGS.
09-23-2009 10:22 AM
09-23-2009 04:59 PM
When our application is installed user see the APplication Permissions message. "Would you like to grant XXXX Trusted Application Status?" and user clicks on "Yes".
Inspite of user selecting Yes for application permission we see this Controlled Access Exception sometimes.
How can we fix this? Is there any reason why this is happening on some devices and only at certain times?
How can we fix this in the code? Do we have to set the ApplicationPermissions explicitily from the code?
Do you have any sample code which we can use?
Thanks almedia so much for your help.
09-23-2009 05:08 PM
There are lots of API methods that throw a ControlledAccessException. You should get the stack trace from the log and figure out what caused it.
You can check if a permission has been granted to your application with the ApplicationPermissionManager. If you determine that you do not have the appropriate permissions, you can invoke a permission request on the manager and pass an ApplicationPermissions object.
ApplicationPermissionsManager manager = ApplicationPermissionsManager.getInstance();
if (manager.getPermission(ApplicationPermissions.PERM
ISSION_CHANGE_DEVICE_SETTINGS) != ApplicationPermissions.VALUE_ALLOW) { ApplicationPermissions permissions = manager.getApplicationPermissions();
permissions.addPermission(ApplicationPermissions.P
ERMISSION_CHANGE_DEVICE_SETTINGS); manager.invokePermissionsRequest(permissions);
}
The return value of invokePermissionsRequest tells you if it worked. You can do addPermission for all the permissions that your application needs and then pass the whole thing to invokePermissionsRequest. The system will handle prompting the user for the changes.
09-23-2009 05:11 PM
Thanks for the quick response.
We did analyze the stack trace and noticed that it is failing at addGlobalEventListener
guid:0x9C3CD62E3320B498 time: Thu Sep 17 17:15:57 2009 severity:1 type:3 app:Java Exception data:
ControlledAccessException
No detail message
net_rim_cldc-16(4A42F4E8)
ApplicationControlImpl
assertIPCAllowed
0x2D1A
net_rim_cldc-16(4A42F4E8)
ApplicationControl
assertIPCAllowed
0x129B
net_rim_cldc-6(4A42F4E8)
Application
addGlobalEventListener
0x1852
ETradeMobileProApp-4(4A5D1D17)
ETradeMobileProApplication
doInitialization
0x1AF
ETradeMobileProSplash(4A5D1D2A)
ETradeMobileProStartup$1
run
0x412
net_rim_cldc-1(4A42F4E8)
Thread
run
0xB3F1
09-23-2009 05:38 PM