Howto connect to Bluetooth LE Device on Android (Platform 19) -
I am working with BT's low energy efficient warning warning device () and successfully added it to my Nexus 7 .
After the following, I would like to connect to the device using the following code:
Personal Bluetooth Getbackback Callback = New Bluetooth Getbackback () {@ConnectationStateChange Bluetooth Get gate, intrared status, Int Newstate) {Log.i (Tag, "Change the On-on-Change Condition [" + newState + "]"); If (newstate == Bluetooth profile. STATE_CONNECTED) {Log.i (TAG, "take device connected"); OnConnect (gatt.getDevice ()); } And if (Newstate == BluetoothProfile.STATE_DISCONNECTED) {Log.i (TAG, "Take Device Disconnected"); OnDisconnect (gatt.getDevice ()); }} @ Ignore public spaces on the server (Bluetooth gate, the status of the int) {log (i.e., "inventory discovery"); }}; (Bluetooth device device: Bluetooth adapter .gate default adapter (). Closedband devices ()) {int type = device.type (); If (type == Bluetooth device .DEVICE_TYPE_LE || type == Bluetooth device. DEVICE_TYPE_DUAL) {list & lt; Bluetooth devices & gt; ConnectedDevices = bluetoothManager.getConnectedDevices (BluetoothProfile.GATT); (! Combined option. Resource (Tools)) {BluetoothGetGet = Device.ConnectGate (appGetContact (), false, callback); Gatt.connect (); Gatt.discoverServices (); & Lt; BluetoothGattService & gt; Services = Gate.Get Services (); }}} However no connection can be started. After a while (a few seconds) the connection status varies in the Bluetooth profile. STATE_DISCONNECTED - even the Bluetooth profile. STATE_CONNECTED has never reached Am I doing something wrong here?
Well, it turns out that my code was absolutely right bluetooth stack has a defective The situation was recorded which could be recovered by closing the device and then turning it on again.
FYI: I have a Nexus 7 device, one of the first versions (I think it came at the end of 2012) and recently has one.
Bluetooth Low Energy 2012 does not work on Nexus 7. (Not switching it on and after it again).
Both devices are running Android 4.4.2.
I have concluded that Bluetooth does not work on low power Nexus 7 2012 and is unstable on the current Nexus 7.
How sad it is
Comments
Post a Comment