如何在Android AIR上获取可用网络列表()

【如何在Android AIR上获取可用网络列表()】千金一刻莫空度,老大无成空自伤。这篇文章主要讲述如何在Android AIR上获取可用网络列表?相关的知识,希望能为你提供帮助。
我尝试使用谷歌搜索,但我发现的只是Adobe和Freshplanets NetworkInfo ANE的NetworkInfo。由于某种原因,NetworkInfo无法正常工作,而且newplanets network-info API无法做到这一点。还有其他方法可以完成这项任务吗?
我从这个使用networkInfo的链接下载了这个例子:[http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/networkinfo.html][1]
以下是上面示例中主类的代码:
/*
ADOBE SYSTEMS INCORPORATED版权所有2011 Adob??e Systems Incorporated保留所有权利。
注意:Adobe允许您根据随附的Adobe许可协议的条款使用,修改和分发此文件。如果您从Adobe以外的来源收到此文件,则您的使用,修改或分发需要事先获得Adobe的书面许可。
*/

package {import com.adobe.nativeExtensions.Networkinfo.InterfaceAddress; import com.adobe.nativeExtensions.Networkinfo.NetworkInfo; import com.adobe.nativeExtensions.Networkinfo.NetworkInterface; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.text.TextField; import flash.text.TextFormat; public class NetworkInfoUsageApp extends Sprite { private var info:TextField; public function NetworkInfoUsageApp() { super(); stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; var ntf:Vector.< NetworkInterface> = NetworkInfo.networkInfo.findInterfaces(); info = makeTextField(50, 50); for each (var interfaceObj:NetworkInterface in ntf) { trace("Interface Name:" + interfaceObj.name + " " ); trace("MTU:" + interfaceObj.mtu.toString + " " ); trace("Display Name of the Interface:" + interfaceObj.displayName + " " ); trace ("Active ?" + interfaceObj.active.toString() + " " ); trace("Hardware Address:" + interfaceObj.hardwareAddress + " "); info.appendText("Interface Name:" + interfaceObj.name + " " ); info.appendText("MTU:" + interfaceObj.mtu.toString() + " " ); info.appendText("Display Name of the Interface:" + interfaceObj.displayName + " " ); info.appendText("Active ?" + interfaceObj.active.toString()+ " "); info.appendText("Hardware Address:" + interfaceObj.hardwareAddress + " "); for each(var address:InterfaceAddress in interfaceObj.addresses) { trace("Address" + address.address + " "); trace("broadcast address" + address.broadcast + " "); trace("ipversion" + address.ipVersion + " ") trace("prefixlength" + address.prefixLength +" ")info.appendText("Address" + address.address + " " ); info.appendText("broadcast address" + address.broadcast + " " ); info.appendText("ipversion" + address.ipVersion + " "); info.appendText("prefixlength" + address.prefixLength +" " ); }}} private function makeTextField(x:Number, y:Number):TextField { var tf:TextField = new TextField(); tf.x = x; tf.y = y; tf.border=true; this.stage.addChild(tf); tf.height = 800; tf.width = 450; tf.type = "input"; var tff:TextFormat=new TextFormat(); tff.size=18; tff.color=0x0000ff; tf.defaultTextFormat=tff; tf.setTextFormat(tff); tf.text="hello"; return tf; } }

}
当我从Flash Pro运行电影时,我收到此错误:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.adobe.nativeExtensions.Networkinfo::NetworkInfo/findInterfaces()[/Users/gangwar/Documents/Adobe Flash Builder 4.5/NetworkInfoActionScriptLibrary/src/com/adobe/nativeExtensions/Networkinfo/NetworkInfo.as:70] at NetworkInfoUsageApp()[C:UsersDaniDesktopwifi testNetworkInfoUsageAppsrcNetworkInfoUsageApp.as:39] at runtime::ContentPlayer/loadInitialContent() at runtime::ContentPlayer/playRawContent() at runtime::ContentPlayer/playContent() at runtime::AppRunner/run() at ADLAppEntry/run() at global/runtime::ADLEntry()

当我发布apk并在我的设备上运行它。什么都没有,只有白色。
答案并非所有移动设备都支持NetworkInfo。轮询isSupported标志,看看你是否有权访问。如果你这样做,只需将findInterfaces()调用为retreive和NetworkInterface对象数组。
另一答案我找到了另一个令人敬畏的ANE,它完美无缺。它被称为“WifiTags”。它适用于Windows和android。感谢所有回答的人。
Tutorial for WifiTags

    推荐阅读