我正在使用 Flash Builder 为 Android 手机构建移动应用程序。我想知道是否可以检查蓝牙(开/关)并在它关闭时启用它。我正在使用互联网检查如下所示的连接,但我也想使用蓝牙检查激活并与其他设备配对。请帮忙!!
<fx:Script>
<![CDATA[
import air.net.URLMonitor;
import mx.managers.PopUpManager;
import views.BloodVialsHomeView;
private var monitor:URLMonitor;
[Bindable] private var isConnected:Boolean;
protected function init():void {
monitor = new URLMonitor(new URLRequest("http://google.com/"));
monitor.addEventListener(StatusEvent.STATUS, checkConnection);
monitor.start();
}
private function checkConnection(e:StatusEvent):void {
connectionIndicator.currentState = monitor.available ? "connectionOn" : "connectionOff";
if(!monitor.available){
openAlert();
}
}
private function openAlert():void {
mobileAlert.open(this, true);
PopUpManager.centerPopUp(mobileAlert);
}
public function exitApp():void {
NativeApplication.nativeApplication.exit();
}
]]>