3

Anyone having issues on using the Nexus 4 to connect to a BLE Device? I am using a BLE module based off of the TI CC2540. I was able to connect to the BLE device, discover services, write to characteristics, and write to descriptors for notifications. Then all of a sudden I am not able to connect to the device anymore. I unpaired the device from the phone, did a factory reset as well, and nothing seems to work.

I also was following what others did in this post Android 4.3 Bluetooth Low Energy unstable

I disabled wifi, retstarted the Bluetooth module on the phone by disabling it and then enabling it. Like I said above this worked for a while, but now I cannot connect to the device using the connectGatt method. I also have the Samsung G4 that used the Samsung BLE SDK with Android 4.2.2 working with this same Bluetooth module which works still.

The main thing that I can see in the logcat is that a null pointer exception occurs when I do call the connectGatt(this, false, mBleGattCallback) is this:

10-07 16:29:04.745: DEBUG/BtGatt.GattService(1090): onConnected() - clientIf=4, connId=4, address=3C:2D:B7:84:F8:83
10-07 16:29:04.745: DEBUG/BluetoothGatt(13165): onClientConnectionState() - status=0 clientIf=4 device=3C:2D:B7:84:F8:83
10-07 16:29:04.745: WARN/BluetoothGatt(13165): Unhandled exception: java.lang.NullPointerException

I can see the code that is being called from the AOSP here: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/bluetooth/BluetoothGatt.java

Which seems strange since I hand the callback to the connect call which is not null. Anyone have any ideas?

Community
  • 1
  • 1
nick_mn
  • 221
  • 3
  • 9

1 Answers1

0

See my reworked answer to Android 4.3 Bluetooth Low Energy unstable I added my experience with Samsng Galaxy S3 while connecting. Maybe that works for you.

If you have a different problem and you analyzed it well, you can write an email to the samsung engineers: blesdk (this is the at sign) samsung [dot c om )

Community
  • 1
  • 1
OneWorld
  • 17,512
  • 21
  • 86
  • 136
  • Hi OneWorld, I was able to fix my issue way back. I could not pinpoint it to anything wrong that I was doing. So I decided to create a new project and start to reincorporate pieces of things back in one by one. After I did that, I add some more code to make it more robust. Which is pretty much everything you mentioned in your reworked answer. Making sure to close resources and instances of the Gatt API, and relaunching when necessary. Also to make sure to proceed with commands in a synchronous nature. Thanks for the feedback and wanting to help. – nick_mn Feb 28 '14 at 19:30