开发者

Android cancelDiscovery Bluetooth does not work

I want to stop Bluetooth discovery process by a button click. I use btAdapter.cancelDiscovery(), but my app still scans for devices. I already put BLUETOOTH_ADMINpermission in manifest. Do I miss something here?

Edit: Post from Logcat

DEBUG/TAG(2901): stop Discovery
ERROR/BluetoothEventLoop.cpp(98): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/2664/hci0
ERROR/BluetoothService.cpp(98): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Er开发者_如何学Goror.Failed (Invalid discovery session)
INFO/DTUN_CLNT(2664):     Client calling DTUN_METHOD_DM_START_DISCOVERY (id 2)
INFO/(2649): DTUN_ReceiveCtrlMsg: [DTUN] Received message [BTLIF_DTUN_METHOD_CALL] 4354
INFO/(2649): handle_method_call: handle_method_call :: received DTUN_METHOD_DM_START_DISCOVERY (id 2), len 0


I create a new project to test cancelDiscovery(). Once we call this method, ACTION_DISCOVERY_FINISHED is broadcasted. In my case, I use handler to repeat the discovery process, so I have to stop it as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜