04-27-2011 05:58 AM
In my application I want to check if device is connected to a wifi network and then I want to check if internet connection is available by the wifi network.
RIM API provides tools to detect if device is connected to wifi network.
Does anybody know if RIM API provides a way to check if internet connection is available without doing a ping manually ?
Thanks in advance.
04-27-2011 06:16 AM
this code can help you to check if Wifi is available for your device or not..
if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED && RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN))
Dialog.alert("wifi connection available.")
Dialog.alert("wifi connection not found!");
use this code to check wifi connection.. and Enjoy...
04-27-2011 06:28 AM
Ok thank you. I am going to try this code.
If my BB is connected to hotspot browser but I am not logged in I cannot connect to the internet.
Do you know if your code will return "wifi not available" in this case ?
04-27-2011 06:37 AM
yes dude. em definately sure that it works perfectly, cause i have also used this code in my application and it is working fine for me....
Good Luck to you ....
Don't Say thanks, press the kudos button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
04-27-2011 07:08 AM
Thank you albert.
I suppose this code checks if internet is avalaible :
WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED
WLANInfo is available in 4.3 and later. Do you know if API version 4.2.1 provides tools to do the same thing ?
04-27-2011 10:02 AM
there is another dicussion going on around a similar topic. Just because WIFI is available doesn't actually mean it can be used. The problem arises when the device is connected but needs credentials. The conclusion was that a call needs to be made to insure that one can actually route to the desired server.
04-29-2011 05:49 AM
When you say "The conclusion was that a call needs to be made to insure that one can actually route to the desired server". That means doing a ping to the desired server ?
04-29-2011 08:04 AM
Somehow you need to make sure that you can actually reaach the destinattion server...a ping may work (problem is that ping may be turned off on the server) or making some kind off call to check the connection.