Thank you for visiting the BlackBerry Support Community Forums.
- Kevin Michaluk, Founder, CrackBerry.com
05-07-2013 12:41 PM
I have registered a SendListener to intercept outbound emails. When my handler is called I would like to access my application settings stored in PersistentObject to determine what I should be doing in my sendMessage Handler.
The problem is I can't access any information set in my application. I suspect this is because my sendMessage Handler is running in the context of the mail application.
What design do I need to follow to access my persistent store from a handler like this?
Solved! Go to Solution.
05-07-2013 12:49 PM
I must admit I have not actually tested this recently myself, but AFAIK you should be able to access your Persistent Objects - assuming your are running using your own code and Persistent Object classes, the context should not matter.
Can you describe the issue when you attempt to access the information? If your objects seem to be 'null' then I would suspect you are using static references. static variables are specific to a context, so your listener will see different static variables to your application.
The reason I have not tested this recently is that normal practice for listeners is to context switch to your own Application, and the usual way to do this is via a GlobalEvent
05-07-2013 12:55 PM
My application wraps its settings in a class, the settings are stored inside a Hash table defined as follows:
static Hashtable settingsTable;
You suspect the static declaration is the problem?
I'd not considered the context switch - I will investigate that too.
05-08-2013 02:48 AM