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
aykarthik
Posts: 187
Registered: ‎08-13-2008
My Device: Not Specified

How to identify whether wifi connection is currectly enable or not?

Hi Guys, 

 

I need to identify currently which wireless connection (wifi or gprs) is used for global communication via programming.

 

 

Thanks in advance,

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to identify whether wifi connection is currectly enable or not?

Use the following call:

 

RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)

 

it is available since RIM API 4.2.1

Developer
aykarthik
Posts: 187
Registered: ‎08-13-2008
My Device: Not Specified

Re: How to identify whether wifi connection is currectly enable or not?

Thanks for your reply.

 

But actually i am developing an application which needs to know if the wifi is connected (wifi is ON or off)...if not we will try to use the dataconnection (in this case GPRS).

 

Please let me know if it is possible to know it programmatically.

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to identify whether wifi connection is currectly enable or not?

Compose a special url like that:

 

String wifiURL = genericURL + ";interface=wifi"; 

 

and try to open HTTPConnection with wifiURL

 

if it opens ok - then wifi enabled, otherwise - not.

Developer
aykarthik
Posts: 187
Registered: ‎08-13-2008
My Device: Not Specified

Re: How to identify whether wifi connection is currectly enable or not?

Yes. you are correct am also using like this.

 

wifi connection:  String wifiURL = genericURL + ";interface=wifi"; 

 

GPRS connection:  String wifiURL = genericURL;

 

For example after installed an application i dont know whether user is using wifi connection or gprs connection in that time how can i make a connection without interrupt?

 

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to identify whether wifi connection is currectly enable or not?

It is more non-technical than technical issue.

 

I do not know end-user audience for your application, but I'll try to suggest.

 

Show dialog to user like "Select protocol: GPRS or WiFi. Later you can change this setting via Menu-Settings"

 

Also this dialog should have an option to recognize protocols available. This option won't run by itself.

 

User will see this option in dialog box and can launch it or specify protocol manually.

 

In case user has launched automatic recognition - check protocol availability as described and ask to user which to be selected if there is more than one protocol is available.

Developer
aykarthik
Posts: 187
Registered: ‎08-13-2008
My Device: Not Specified

Re: How to identify whether wifi connection is currectly enable or not?

Thank you very much for your response.. I will try on it..
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to identify whether wifi connection is currectly enable or not?

You are welcome :smileyhappy:
Developer
johnbibs
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800

Re: How to identify whether wifi connection is currectly enable or not?

[ Edited ]

is this solved already?

 

while doing some research i just bumped into this thread.:smileyhappy:

 

anyway here's another way to check if wifi is enabled or not.

 

 

if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_CARRIER,RadioInfo.WAF_WLAN, false)){
    coverageWiFi = true;
    wifiLog.addlog("Coverage Status: Online");

 

 

Source: 

 http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

Message Edited by johnbibs on 09-19-2009 07:48 AM
Message Edited by johnbibs on 09-19-2009 07:49 AM