Flash Builder を使用して、Android Phone 用のモバイル アプリケーションを作成しています。Bluetooth(ON/OFF)を確認し、OFFの場合は有効にできるかどうか知りたいです。インターネットを使用して以下に示す接続を確認していますが、Bluetooth チェックの有効化と他のデバイスとのペアリングも使用したいと考えています。助けてください!!
<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();
}
]]>