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

Adobe AIR Development

New Contributor
Posts: 7
Registered: ‎01-13-2011
My Device: Not Specified

check for an internet connection

Is there a known way to check for an internet connection? My app uses an external web service to load data into my app. If on wifi everything works great...but if there is no wifi or internet connection, it just fails. Is there a way to test for a connection? I'm concerned this will be used against me in the app approval process. Any help would be greatly appreciated.

Posts: 345
Registered: ‎03-13-2011
My Device: Playbook
My Carrier: n/a

Re: check for an internet connection

[ Edited ]

How about URLMonitor and SocketMonitor? You can find out more here:



New Developer
Posts: 34
Registered: ‎03-23-2011
My Device: Bold 9700
My Carrier: Rogers

Re: check for an internet connection

I had that same issue.  Here's how I did it. This will even tell you what your IP is.





import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.Socket;


Socket Sonnection:

var socket:Socket = new Socket();
socket.addEventListener(IOErrorEvent.IO_ERROR, socketError);
socket.addEventListener(Event.CONNECT, socketConnect);
socket.connect("google.com", 80);



Connection Events:

private function socketConnect(event:Event):void
	ip = event.target.localAddress;
	connected = true;
private function socketError(error:IOErrorEvent):void