05-31-2012 07:34 AM
hi,
how can i find out, if a wifi-connection is available?
my app only works with internet and i want to throw a message right at the start, because otherwise it would only look broken.
i was very surprised that i couldn't find anything on this board, because the problem seems pretty basic
thanks
Solved! Go to Solution.
05-31-2012 08:41 AM
you can try the below code snippet to check the wifi is avilable or not
private boolean isWifiAvilable()
{
ConnectionFactory connectionFactory = new ConnectionFactory();
int[] types =
{
TransportInfo.TRANSPORT_TCP_WIFI,
};
connectionFactory.setPreferredTransportTypes(typ
connectionFactory.setAttemptsLimit(1);
connectionFactory.setConnectionTimeout(1000);
ConnectionDescriptor connectionDescriptor = connectionFactory.getConnection(url, TransportInfo.TRANSPORT_TCP_WIFI, null);
if (connectionDescriptor != null)
{
return true;
}
return false;
}
http://www.blackberry.com/developers/docs/7.1.0api
05-31-2012 05:45 PM
thanks for your quick answer.
but that isn't actionscript(!?)
i can't create a connectionfactory object
05-31-2012 08:17 PM
06-01-2012 02:02 AM
This tutorial should get you what you need:
http://tv.adobe.com/watch/adc-presents/detecting-n
06-04-2012 09:51 AM
i did it with an url request and it seems to work ![]()
here is the code:
public class WiFiChecker extends EventDispatcher
{
public static var _WIFIAVAILABLEEVENT:String = "WIFIAVAILABLE";
private var _wifiAvailable:Boolean = false;
private var _timer:Timer = new Timer(1000, 1);
public function WiFiChecker()
{
var request:URLRequest = new URLRequest("http://www.google.com");
var loader:URLLoader = new URLLoader(request);
loader.addEventListener(Event.COMPLETE, doneLoading);
loader.load(request);
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerRanOut);
}
private function timerRanOut(e:Event):void{
trace("WiFi Ping-TimeOut");
this.dispatchEvent(new Event(_WIFIAVAILABLEEVENT));
}
public function wifiIsAvailable():Boolean{
return _wifiAvailable;
}
private function doneLoading(e:Event):void{
_wifiAvailable = true;
this.dispatchEvent(new Event(_WIFIAVAILABLEEVENT));
}
}
06-04-2012 10:05 AM
09-13-2012 02:22 PM
Along with greeting I ask help to develop a product on the platform RIM-OS specifically on Wifi API.
I wonder if can by API level (code) manage wireless networks?
can we change the priority setting too?.
How to create WIFI profiles from code and you can connect / disconnect from a WiFi network?.
And finally, if you can manage networks profiles like EAP / AKA - EAP / SIM from code?.
If exists a way to do it, can you explained to us?
For this I suggest if you can guide me on where and how to do it, or if there is some kind of commercial support for companies (paid) on the use of these APIs.
Thank you for your cooperation and we are in contact.
09-13-2012 02:45 PM