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

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: 'ControlledAccess' exception for persistent storage when launching from alternate entry point

[ Edited ]

Where your code is located, and which application runs your code can be completely different things. 


Listeners are an example of the Observer pattern, you register your Listeners to observe some action, and then the Application that actually initiates that action runs your Listener.  So typically Listeners will run as a method in a process actually being run by another Application. 


To give you another example of 'location of code does not have anything to do with who is running the code', think about all the Operating system processing that you do.  You don't have classes called UiApplication or MainScreen in your Application do you?  But the code that creates these will be being run as part of your Application. 


But getting back to this problem, you need to move the data from the Listener (not your Application) into some processing that is being run in your Application. 


The usual way is to use a Global Event.  You use the Listener to capture the data you want, then fire a Global Event - this code will be performed in your Listening method, but NOT in your Application.  You will have a Global Event Listener defined in your Application, the point here is that Global Events are actually run in your Application (on the Event Thread I think, but that detail is probably not relevant).  So a Global Event listener has all the rights of your Application, so it can take the data that the Listener has captured for you and process it however it likes. 


Hope this makes sense. 




You need to create GUIDs that are unique to your Application.  All Global Event Listeners get to see all Global Events.  They will ignore ones that they don't recognize.  So create a GUID (you probably have one anyway that you use for PersistentStore) and then use that to fire Global Events, knowing that the only listener that will understand this GUID is yours. 

Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: 'ControlledAccess' exception for persistent storage when launching from alternate entry point

(and other overloaded versions)
can be used to post a selfdefined global event.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 13
Registered: ‎02-07-2010
My Device: 8300 Simulator
My Carrier: Simulator

Re: 'ControlledAccess' exception for persistent storage when launching from alternate entry point

Yes, now it totally makes sense. Thanks.