Extend Android Bluetooth Discoverability -
i writing application relies on android device (for current testing purposes htc evo 4g , several original motorola droids) being discoverable via bluetooth 300 seconds.
i targeting android version 2.0.1, according api should able prompt user enable discoverability maximum of 300 seconds. on both droids , evo prompt window has 300 seconds listed, both end after 120 seconds.
the code used prompt user here:
private void makediscoverable() { intent discoverableintent = new intent( bluetoothadapter.action_request_discoverable); discoverableintent.putextra( bluetoothadapter.extra_discoverable_duration, 300); startactivity(discoverableintent); } i code runs. however, later have handler when discoverability status changes (in case ends, assume) reads this:
if (isdiscoverablechange(action)) { int discoverstate = intent.getintextra( bluetoothadapter.extra_scan_mode, short.min_value); if (isdiscoverablestate(discoverstate)) { setitorder(); setupscananddisplay(); } else { discoverscheduler.cancel(); itscheduler.cancel(); } } private boolean isdiscoverablechange(string action) { return bluetoothadapter.action_scan_mode_changed.equals(action); } private boolean isdiscoverablestate(int state) { return state == bluetoothadapter.scan_mode_connectable_discoverable; } i tried commenting out portion runs when discoverability mode ends, in case cancelling prematurely, discoverability end after 120 seconds.
is hardware issue, or doing wrong here?
it appears bug:
issue 15486: bluetooth adapter.extra discoverable not obeyed http://code.google.com/p/android/issues/detail?id=15486
issue 13361: bluetoothadapter.extra_discoverable_duration intent not extend 120 sec discovery interval http://code.google.com/p/android/issues/detail?id=13361
first reported dec 22, 2010, still listed 'new' status, wouldn't expect fixed.
Comments
Post a Comment