11-28-2012 04:17 AM
Please I am having problems keeping a socket connection in my application alive for a long period. It seems to disconnect after a short while (every 2 minutes) especially if idle.
It happens that I am writing an application with a Chat feature and this requires I keep a socket connection Alive for the life-tme of my application. I have already tried tricks like pinging server every minute, but then this constitute a drain of (Blackberry) resources. Blackberry Push isnt an option (as i have other clients other than BB devices).
Please does anyone know how i can solve this or still suggest another alternative way of going about this?
Solved! Go to Solution.
11-28-2012 05:10 AM
11-28-2012 05:15 AM
I agree with the previos responder. The problem that you have is the reason RIM invented push. I am not aware of a way round this. If you can't use push, then you are going to have to keep alive and so your app will suffer the battery drain and possibly the additional charges associated with data traffic.
Some people have used email instead of Push as a wau of notifying the application that there is something for it - this requires a email listener in the application to process and remove these notification emails.
If you do use a keep alive message, then I think this quesiton becomes moot:
"how do i even differentiate between blackberry......"
11-28-2012 05:20 AM
I have accepted as a solution. Though clumsy and NOT what we developers would have wanted by a large margin. I am trying to do some asynchronous communication between server/client and the socket alive is used by xmpp.
My question to you though is please do you have any explanation as to why one doesnt have to bother about this in Java SE? Could it be simply because BB Dev is largely different?
11-28-2012 05:24 AM