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
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.