守望者--AIR技术交流
标题: 检查网络连接ANE [打印本页]
作者: 破晓 时间: 2015-1-23 15:14
标题: 检查网络连接ANE
Air Native Extension for social messaging on iOSThis is an Air native extension for checking network connectivity on iOS. It works with a single common interface on iOS and on all platforms supported by Air’s NetworkInfo class.
Binary filesThe bin folder contains the compiled extension and the default swc, which can be used for local testing if required by your development environment (Flash Builder shouldn’t need it, but other IDEs may).
Using the extensionTest if the extension is supported- NetworkStatus.isSupported : Boolean;
复制代码Is a boolean. Will return false on platforms where the extension is not supported.
Test if the device has an active network connection
- NetworkStatus.hasConnection : Boolean;
复制代码 Get a vector of all network interfaces
- NetworkStatus.findInterfaces() : Vector.<NetworkInterface>
复制代码 Receive notifications when the network status changes
- NetworkStatus.startCheckingForConnection( interval : int ) : void
复制代码where interval is the number of seconds between each check.
When the network status changes the signal
- NetworkStatus.networkStatusChanged
复制代码 will dispatch, with a parameter indicating if the network has a connection or not. So listen for this signal with a function like
- function statusChanged( hasConnection : Boolean ) :void { ... }
复制代码 which you add to the signal with
- NetworkStatus.networkStatusChanged.add( statusChanged );
复制代码 To stop polling for changes in the connection status
- NetworkStatus.stopCheckingForConnection() : void
复制代码 LicenseThis project is licensed under the
BSD license
[attach]589[/attach]
相关链接:
https://github.com/StickSports/Network-ANE
| 欢迎光临 守望者--AIR技术交流 (http://www.airmyth.com/) |
|