Android Wear device not detected when scanning Bluetooth devices -
i'm doing bluetooth discovery (not bluetooth le) hoping find android wear never found. code discovery i'm pretty sure it's ok, because can find other devices (tv's bluetooth, sony smartband, etc) never sony smartwatch 3.
any idea if possible?
here's code:
final intentfilter filter = new intentfilter(); filter.addaction(bluetoothdevice.action_found); filter.addaction(bluetoothadapter.action_discovery_finished); context.registerreceiver(mbroadcastreceiver, filter); final bluetoothadapter bluetoothadapter = bluetoothadapter.getdefaultadapter(); bluetoothadapter.startdiscovery();
...
private broadcastreceiver mbroadcastreceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { string action = intent.getaction(); if (bluetoothdevice.action_found.equals(action)) { short rssi = intent.getshortextra(bluetoothdevice.extra_rssi, short.min_value); bluetoothdevice device = intent.getparcelableextra(bluetoothdevice.extra_device); if (!mdevicelist.contains(device)) { mdevicelist.add(device); } } else if (bluetoothadapter.action_discovery_finished.equals(action)) { // we're done here context.unregisterreceiver(mbroadcastreceiver); final bluetoothadapter bluetoothadapter = bluetoothadapter.getdefaultadapter(); bluetoothadapter.canceldiscovery(); if (monbluetoothdiscoveryfinished != null) { monbluetoothdiscoveryfinished.ondiscoveryfinished(mdevicelist); } } } };
cheers/
Comments
Post a Comment