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
Highlighted
Contributor
Posts: 12
Registered: ‎08-25-2011
My Device: Bold 9780
My Carrier: Vodafone

Edge, 2G, 3G Change Detection

Is there a way of detecting a change in the type of data signal the blackberry is getting.

 

i'm controlling a socket, which has a tendency to hang my app when the phone moved between 2g and 3g signals, I get my app terminated by the OS for being unresponsive.

 

is there a way of detecting this change in data signa in a sensible way so i can disconnect and then reconnect my socket to avoid the hang, or a way of stopping my application hanging on the thread and getting terminated?

 

Cheers

Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Edge, 2G, 3G Change Detection

if your app gets terminated, most likely you are blocking the event thread.
use a separate thread for all blocking operations, like i/O.

to check the network you can use http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/system/RadioStatusListener.htm... together with http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/system/RadioInfo.html#NETWORK_... (or cdma etc)
----------------------------------------------------------
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
Contributor
Posts: 12
Registered: ‎08-25-2011
My Device: Bold 9780
My Carrier: Vodafone

Re: Edge, 2G, 3G Change Detection

Interestingly i have been playing with new threads for IO, but this seemed to lose all reference to my application and cause other issues.

 

My Network object is what controls all network IO, and I store my Network object as a singlton in the runtime store., but on occasion i was having multiple network objects created instead of just my one.

 

I also had issues in that the network seems completely disconnected from my main app in terms of what it was doing.

 

Not sure how to structure it, is there any material i can read about how to structure this?

Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Edge, 2G, 3G Change Detection

maybe this video helps a bit:
http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865

you can also take a look at peters sample code:
http://supportforums.blackberry.com/t5/Java-Development/Sample-HTTP-Connection-code-and-BIS-B-Access...
----------------------------------------------------------
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