If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
skynetchris
Posts: 39
Registered: ‎07-18-2008
My Device: Not Specified

Radio on off alternative.

Hi guys, I only just found this forum and I've already written code for activating and deactivating radio. I saw a solution posted on this forum but am wondering if mine is also correct, take a look and let me know if you think it wouldn't work:

 

//This will check to see if GPRS is disabled. if (net.rim.device.api.system.RadioInfo.isDataServiceOperational()==false){ //If radio (GPRS) is disabled, this will enable it. net.rim.device.api.system.Radio.activateWAFs(net.rim.device.api.system.RadioInfo.NETWORK_GPRS); }

This should re-enable radio so that an application can connect to the net? I did a small amount of testing and it seemed to work fine.

 

Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Radio on off alternative.

Only the RadioInfo.WAF_* constants should be passed into the activateWAFs method.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
skynetchris
Posts: 39
Registered: ‎07-18-2008
My Device: Not Specified

Re: Radio on off alternative.

I have a problem with a thread that sends information back to our server via GPRS (EDGE).

 

If radio is turned off, for example from Manage Connections->Turn all connections off

 

The following code in a simulator environment will turn the radio (GPRS/EDGE) back on:

 

int iState = RadioInfo.getState(); if (iState==0){ //switches the network on Radio.activateWAFs(RadioInfo.WAF_3GPP); //for GSM Radio.activateWAFs(RadioInfo.WAF_CDMA); //for CDMA }

 

However, it DOESN'T work on a BB 8800 or BB 8110. Has anyone else tested this on an actual handset and not just the simulator?
Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Radio on off alternative.

What is not working?  Does the code inside your if statement run?  Note that you should compare the value returned from RadioInfo.getState to the constants defined in the RadioInfo class, not hard coded values.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.