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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
ingvar_e
Posts: 551
Registered: ‎10-31-2009
My Carrier: Movistar, Telenor

phonelistener revisited

[ Edited ]

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"?

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: phonelistener revisited

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.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
ingvar_e
Posts: 551
Registered: ‎10-31-2009
My Carrier: Movistar, Telenor

Re: phonelistener revisited

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

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Please use plain text.
Developer
peter_strange
Posts: 17,713
Registered: ‎07-14-2008

Re: phonelistener revisited

"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/livelink.exe/fetch/2000/348583/800332/832062/How_to_...

Please use plain text.