bluetooth lowenergy - Solution for BLE scan's SCAN_FAILED_APPLICATION_REGISTRATION_FAILED? -


my android app scans ble devices, , point start fails error code 2 (scancallback.scan_failed_application_registration_failed). i'm using nexus 9, 5.0.1 lollipop.

this problem continued after relaunched app, , when restarted bluetooth service settings, rid of problem. problem recurring, , think i'm coding in wrong way; ble related apis new , there few information.

does know general solution error, preferably not requiring restart of bluetooth service? though error code documented in android api reference, don't know how handle properly.

when got error

scan_failed_application_registration_failed 

you should disable bluetoothadapter

bluetoothadapter.getdefaultadapter().disable(); 

disabling bluetoothadapter, event state_turning_off fired. once event fired, try reconnect bluetoothadapter:

case bluetoothadapter.state_off:   log.d(tag, "bluetooth adapter turned off");   handler.postdelayed(new runnable() {     @override     public void run() {         log.d(tag, "bluetooth adapter try enable");         bluetoothadapter.getdefaultadapter().enable();     }}, 500);   break; 

Comments

Popular posts from this blog

Round ImageView Android -

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

javascript - How to add fields to activeform with js/jQuery in Yii2? -