0

我正在使用 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();
    }
]]>

4

1 回答 1

0

这与其说是 Flash Builder 问题,不如说是 AIR 问题。也许这个其他问题可以指导您:Bluetooth Android - adobe Air

于 2013-05-15T22:15:14.513 回答