jaxim
jaxim

Reputation: 545

Adobe Air - Detect if connection (i.e. WIFI, 3G, 4G) is active on any device

I'd like to know how to determine any device is internet connected within an ActionScript 3 project.

I found a way to determine if an iOS device is connected using Adobe's Native Extension by checking if an active NetworkInterface's name is "en0", "en1" (for WIFI connection) or "pdp_ip0", "pdp_ip1", "pdp_ip2"(data connection) from the following stackoverflow page.

However, how do I check other devices if they have an internet connection?

I think I can check if an Android device is connected by seeing of the active NetworkInterface name is wither "wifi" or "mobile" -- though I have not been able to confirm this.

How do I check the internet connection of other devices: i.e. desktops, Amazon, Fire, Nook, Playbook, etc?

Upvotes: 1

Views: 4043

Answers (1)

have you tried with NetworkInfo class?

like following snippet from AIR for Android by Veronique Brossiere

import flash.net.NetworkInfo;
import flash.net.NetworkInterface;
var network:NetworkInfo = NetworkInfo.networkInfo;
for each (var object:NetworkInterface in network.findInterfaces())
{
    trace(object.name, object.active);
}

best regards

Upvotes: 1

Related Questions