This is not so much a Flash Builder question as an AIR one. Maybe this other question can orient you: Bluetooth Android - adobe Air
Can flash builder check If Bluetooth is enabled for Android phone?
-
29-05-2022 - |
Question
I'm using Flash Builder to build a mobile application for Android Phones. I would like to know if it is possible to check for Bluetooth (ON/OFF) and enable it if it is OFF. I'm using the internet to check for connection that shows below but I also want to use Bluetooth check activation and pair to other devices. Please Help!!
<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();
}
]]>
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow