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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 116
Registered: ‎03-15-2011
My Device: Blackberry 9800
My Carrier: developer
Accepted Solution

Turn on/off data services(EDGE/GPRS) programmatically for OS 7.0 and above

[ Edited ]

Hi,

 

My application's requirement is to turn off the Wi Fi and enable the data services(EDGE/GPRS) programmatically. And when data services are enabled, send a request to server and after that Turn the data services off and turn the Wi Fi on.

 

Using following code:

1. To turn off the Wifi: 

if(WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED){
      //device is connected via Wi-Fi
      Radio.deactivateWAFs(RadioInfo.WAF_WLAN);

}

2. To turn off data services:

     Radio.deactivateWAFs(RadioInfo.WAF_3GPP)

 

3. To Turn on data services services:

      Radio.activateWAFs(RadioInfo.WAF_3GPP);

 

Reference: http://supportforums.blackberry.com/t5/Java-Development/How-to-turn-off-Data-services/m-p/1171307#M1...

This is not working for me. I am not getting the Persistence solution.

 

i searched a lot but not getting solution.

 

How can i turn on/off data services through code.

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Turn on/off data services(EDGE/GPRS) programmatically for OS 7.0 and above

Can you please clarify this - I don't understand what you mean Persistence and I don't know which part of the process is not working.

 

"This is not working for me. I am not getting the Persistence solution."

Developer
Posts: 116
Registered: ‎03-15-2011
My Device: Blackberry 9800
My Carrier: developer

Re: Turn on/off data services(EDGE/GPRS) programmatically for OS 7.0 and above

Thanks for Reply.

I am talking about the api i am using to turn on/off data services(point 2 & 3) and one of the workaround mentioned in link
http://supportforums.blackberry.com/t5/Java-Development/How-to-turn-off-Data-services/m-p/1171307#M1...


that is:
PersistentObject persist = PersistentStore.getPersistentObject( OptionsDataServicesData.ID );
persist.setContents( new OptionsDataServicesData() );
persist.commit();
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Turn on/off data services(EDGE/GPRS) programmatically for OS 7.0 and above

That post was not from someone in RIM, in fact as I read it, it is just a guess from ua123.  I very much doubt that solution will work, so I would not pursue that option. 

 

Can you do what you want using the API you have found?

Developer
Posts: 116
Registered: ‎03-15-2011
My Device: Blackberry 9800
My Carrier: developer

Re: Turn on/off data services(EDGE/GPRS) programmatically for OS 7.0 and above

Thanks Peter!

Below apis are working fine at my end when i checked with BIS enabled SIM:

To enable data services:
Radio.activateWAFs(RadioInfo.WAF_3GPP);
It turns on mobile network.

To disable data services:
Radio.deactivateWAFs(RadioInfo.WAF_3GPP);
It turns off mobile network.