cordova - EXTRA_PREVIOUS_SCAN_MODE always returns an error for Android Bluetooth -
i'm using following code return object cordova when device's bluetooth's scan mode changes (i.e. discoverable/not discoverable).
cordova.getactivity().getapplicationcontext().registerreceiver(new broadcastreceiver(){ @override public void onreceive(context c,intent intent){ jsonobject json=new jsonobject(); try{ json.put("current",intent.getintextra(bluetoothadapter.extra_scan_mode,bluetoothadapter.error)); json.put("previous",intent.getintextra(bluetoothadapter.extra_previous_scan_mode,bluetoothadapter.error)); }catch(jsonexception e){ } pluginresult result=new pluginresult(pluginresult.status.ok,json); result.setkeepcallback(true); discoverablecallback.sendpluginresult(result); // discoverablecallback callbackcontext } },new intentfilter(bluetoothadapter.action_scan_mode_changed)); however, intent.getintextra(bluetoothadapter.extra_previous_scan_mode,bluetoothadapter.error) bluetoothadapter.error. tried setting discoverability on , off several times consecutively , it's bluetoothadapter.error. how make return previous scan mode?
from see in aosp source , extra_previous_scan_modeis never being used. guess documentation google wrong in case . if search here results in no references in whole source code
Comments
Post a Comment