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
Developer
Posts: 321
Registered: ‎05-26-2009
My Device: Not Specified

Automatically detect device is connected to wi-fi and add ";interface=wifi" suffix.

Hi,

Can someone please comment on the following regarding automatically adding connection suffix for wi-fi?

 

1.) For devices running OS>=4.3,  the following check is sufficient.

 

WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED

 

I have seen some posts where the above condition is ANDed with an extra condition. Do we really need to check for areWAFsSupported????

adioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)

 

RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN) && WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED

 

 

2.) For devices running OS lower than 4.3 (4.2.1 or 4.2.0) there is no way to determine if wi-fi is available and add this connection suffix.

 

Thanks,

 

--MB

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

Re: Automatically detect device is connected to wi-fi and add ";interface=wifi" suffix.

you can determine wifi coverage fine prior to 4.3 using CoverageInfo. The only thing you could not do before 4.3+ was to listen for wifi coverage.

----------------------------------------------------------
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
Developer
Posts: 321
Registered: ‎05-26-2009
My Device: Not Specified

Re: Automatically detect device is connected to wi-fi and add ";interface=wifi" suffix.

Looking at Service records only indicates whether device has service record entries. There is no way to tell if the device is actually connected to a wi-fi access point.

Developer
Developer
Posts: 321
Registered: ‎05-26-2009
My Device: Not Specified

Re: Automatically detect device is connected to wi-fi and add ";interface=wifi" suffix.

Anyone!!

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Automatically detect device is connected to wi-fi and add ";interface=wifi" suffix.

What's wrong with the simon_hain's solution?

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Developer
Posts: 321
Registered: ‎05-26-2009
My Device: Not Specified

Re: Automatically detect device is connected to wi-fi and add ";interface=wifi" suffix.

Simon just commented that it is possible but did not suggest a solution.

From what I have searched on this forum, prior to 4.3 there is no way to detect that the device is actually connected to wi-fi.

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

Re: Automatically detect device is connected to wi-fi and add ";interface=wifi" suffix.

 


mb1 wrote:

Simon just commented that it is possible but did not suggest a solution.


 

I mentioned CoverageInfo. Did you at least read the javadoc?

 

To check for MDS coverage over wifi without considering serial bypass:

if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS, RadioInfo.WAF_WLAN, false))

 

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/CoverageInfo.html

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