12-13-2009 06:32 AM - edited 12-13-2009 06:35 AM
Trying to figure out where to place code for deregister a phone listener.
As the story goes. "Yes teacher, I am still confused, but at a higher level"
Example says: -----------
...
MyPhoneDeregister phone_handler;
...
// call this method on exit to deregister the phone listener
private callOnExit()
{
Phone.removePhoneListener(phone_handler);
}
}
---------
Is this code to be placed in the phone listener itself? If so, how do I trigger it? The only code that activates the phone listener is a phone call. Right? If the above code is not to placed in the phone listener what do I put in for "phone_handler"?
12-14-2009 04:48 PM
As you mention, it can be called from within the PhoneListener (one of the listener methods).
If you need to call it from within your application (i.e. a GUI portion) you could store a copy of the PhoneListener in the RuntimeStore when it is first created. That way, you can open the same PhoneListener instance stored as an object in the RuntimeStore at a later time and deregister it.
12-15-2009 03:39 AM
Thanks,
I do have to stop it from the controlling application. Is the method of creating and storing the listener in RuntimeStore
described somewhere. I am having problem implementing a Runtime store so some kind of sample would be helpful
12-15-2009 04:24 AM
"I am having problem implementing a Runtime store so some kind of sample would be helpful"
So where have you looked for a sample?
I've found examples of its use in the Developer Guide, samples supplied and KB, including this very useful example.
How to - Create a singleton using the RuntimeStore
Article Number: DB-00686
http://www.blackberry.com/knowledgecenterpublic/li