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
Developer
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550
My Carrier: Vodaphone
Accepted Solution

Turn On the Data service programmatically

Hi all,

I want to check if Data service is disabled and turn it ON if it is disabled. I checked some solutions like using RadioInfo.isDataServiceOperational(), but it returns false whenever Mobile network is turned off (even if the data service is ON). I also used RadioInfo.getEnabledWAFs(), RadioInfo.getEnabledWAFs() to get the active WAF lists but it returns WAFs even if Data service is Off.

 

Is there some other way to check this? 

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

Re: Turn On the Data service programmatically

maybe check coveragestatus.

there is no api other than radio to activate or deactivate stuff though.
----------------------------------------------------------
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
Developer
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550
My Carrier: Vodaphone

Re: Turn On the Data service programmatically

Yes I checked that too, but is of no use. TransportInfo.addListener(new CoverageStatusListener()) gets called only if some Network is started. No event for Off.
Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Turn On the Data service programmatically

the old one is called i think, with coverage_none, but better check it yourself:
http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/CoverageStatusListener....
----------------------------------------------------------
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
Developer
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550
My Carrier: Vodaphone

Re: Turn On the Data service programmatically

Now I can get the event whenever Data Service is turned on/off but the same event is generated if mobile network or wifi is turned on/off. Is there any way to distinguish them?
Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Turn On the Data service programmatically

you could use coverageinfo in different calls to check what exactly is available when you get the event.
so the event triggers your in-depth check.
----------------------------------------------------------
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
Highlighted
Developer
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550
My Carrier: Vodaphone

Re: Turn On the Data service programmatically

It works great on simulator, but on device it returns same newCoverage code. 1 when Data service or Wifi is turned on, and 0 when turned off.