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.

inside custom component

Java Development

Reply
New Developer
suresh_chakree
Posts: 20
Registered: ‎08-19-2008
My Device: Not Specified
Accepted Solution

Client/Server Push application : How to run listener thread on need basis?

Hi,

 

To receive the content of a server push, a listener thread need to be running in the back ground on the blackberry device.

For a client application to receive the server push updates optimally, what is the best way?

 

1. Running the listener thread on the installation of the client application using auto-run on start up?

What happens to the thread if there is device reboot? Would the listener start again?

 

2. Running the listener thread on the launch of client application?

 

(or)

 

3. Is there a way to run the listener thread on need basis, only when there is a server push , like some notification (invoked by server) to the client that there is server push and then the client starts the listener thread?

 

Kindly provide your valuble inputs and suggest most commonly followed and the best practice.

 

Regards,

Suresh.

Please use plain text.
Developer
simon_hain
Posts: 15,842
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Client/Server Push application : How to run listener thread on need basis?

the first option is commonly used. autostart applications are started on device startup - that also means after a reboot.
see the developer guides for examples and notes.
----------------------------------------------------------
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
Please use plain text.
New Developer
suresh_chakree
Posts: 20
Registered: ‎08-19-2008
My Device: Not Specified

Re: Client/Server Push application : How to run listener thread on need basis?

Thanks Simon for the quick reply.

 

I am curious to know if the third option is possible (3. Is there a way to run the listener thread on need basis, only when there is a server push , like some notification (invoked by server) to the client that there is server push and then the client starts the listener thread?)

Please use plain text.
Developer
simon_hain
Posts: 15,842
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Client/Server Push application : How to run listener thread on need basis?

sure. if it is a good thing to do is another question.
you can use an inboxlistener to receive an email or even an sms with a command to start the pushlistener. but why would you like to do something like this? listening on a port is nothing that drains the battery.
----------------------------------------------------------
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
Please use plain text.