This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

No gattcallback while trying to connect android phone using CC2541

Hi Experts,

I have serious problem which has compatible issue with Android phones. MP schedule is next week and we couldn't solve it yet. Please help to advice how to fix it.

We got below error log from IM-A890K (Android version: 4.4.2) and same error on Galaxy S4 (Android version: 4.3). The compatibility test is not finished yet, but this problem still occurred on specific Android phones as above.

04-02 17:33:19.010: D/VS_SDK(8079): 00:18:31:F0:E0:63 trying to Link
04-02 17:33:19.040: D/BluetoothManager(8079): getConnectionState()
04-02 17:33:19.050: D/BluetoothManager(8079): getConnectedDevices
04-02 17:33:19.070: D/VS_SDK(8079): 00:18:31:F0:E0:63 Disconnect Status with Device
04-02 17:33:19.070: D/VS_SDK(8079): 00:18:31:F0:E0:63의 trying to Link
04-02 17:33:19.070: D/BluetoothManager(8079): getConnectionState()
04-02 17:33:19.070: D/BluetoothManager(8079): getConnectedDevices
04-02 17:33:19.070: D/BluetoothGatt(8079): connect() - device: 00:18:31:F0:E0:63, auto: false
04-02 17:33:19.080: D/BluetoothGatt(8079): registerApp()
04-02 17:33:19.080: D/BluetoothGatt(8079): registerApp() - UUID=d468fa94-c907-40eb-88f4-2b3131a1b5a7
04-02 17:33:19.080: D/BluetoothGatt(8079): onClientRegistered() - status=0 clientIf=5
04-02 17:33:19.080: D/BluetoothGatt(8079): onClientConnectionState() - status=0 clientIf=5 device=00:18:31:F0:E0:63
04-02 17:33:19.080: I/VS_SDK(8079): java.lang.NullPointerException
04-02 17:33:19.080: W/VS_SDK(8079): BluetoothAdapter nor initialized
04-02 17:33:19.080: W/BluetoothGatt(8079): Unhandled exception in callback
04-02 17:33:19.080: W/BluetoothGatt(8079): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6452)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:978)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.view.ViewGroup.invalidateChild(ViewGroup.java:4325)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.view.View.invalidate(View.java:11091)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.view.View.invalidate(View.java:11046)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.widget.TextView.updateAfterEdit(TextView.java:7490)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.widget.TextView.handleTextChanged(TextView.java:7513)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:9263)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.text.SpannableStringBuilder.append(SpannableStringBuilder.java:253)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.text.SpannableStringBuilder.append(SpannableStringBuilder.java:30)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.widget.TextView.append(TextView.java:3459)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.widget.TextView.append(TextView.java:3446)
04-02 17:33:19.080: W/BluetoothGatt(8079): at com.vsscp.vs_activitytracker.custom.Functions.setTextView(Functions.java:212)
04-02 17:33:19.080: W/BluetoothGatt(8079): at com.vsscp.vs_activitytracker.Link_Activity.Connection_Change(Link_Activity.java:206)
04-02 17:33:19.080: W/BluetoothGatt(8079): at com.vsscp.vs_activitytracker.Handlers$1.handleMessage(Handlers.java:46)
04-02 17:33:19.080: W/BluetoothGatt(8079): at com.vsscp.vs_activitytracker.VSService$1.onConnectionStateChange(VSService.java:98)
04-02 17:33:19.080: W/BluetoothGatt(8079): at com.vsscp.vssdk.callback.VSCallbackMethod.onConnectionStateChange(VSCallbackMethod.java:42)
04-02 17:33:19.080: W/BluetoothGatt(8079): at com.vsscp.vssdk.ble.BluetoothLeService.Disconnect(BluetoothLeService.java:316)
04-02 17:33:19.080: W/BluetoothGatt(8079): at com.vsscp.vssdk.ble.BluetoothLeService$1.onConnectionStateChange(BluetoothLeService.java:128)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:168)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:71)
04-02 17:33:19.080: W/BluetoothGatt(8079): at android.os.Binder.execTransact(Binder.java:404)
04-02 17:33:19.080: W/BluetoothGatt(8079): at dalvik.system.NativeStart.run(Native Method)
04-02 17:33:19.080: D/VS_SDK(8079): Trying to create a new connection
04-02 17:33:29.080: D/VS_SDK(8079): Connection failed. Trying to Disconnect
04-02 17:33:29.080: D/VS_SDK(8079): Trying to Disconnect
04-02 17:33:29.080: D/BluetoothManager(8079): getConnectionState()
04-02 17:33:29.080: D/BluetoothManager(8079): getConnectedDevices
04-02 17:33:29.090: D/BluetoothGatt(8079): cancelOpen() - device: 00:18:31:F0:E0:63
04-02 17:33:29.100: D/BluetoothGatt(8079): onClientConnectionState() - status=0 clientIf=5 device=00:18:31:F0:E0:63
04-02 17:33:29.100: I/VS_SDK(8079): Disconnected from GATT Server

The project has 2 features using Custom Service and Selfie Camera using HID profile(Consumer Device). A basic concept of initialization is as below.

  • Hello. What embedded software, hardware platform, and Android app are you using? If these are all custom, this could be a million different things. i would recommend introducing parts of the system that you know work (i.e. simpleBLEPeripheral app, Android sensor tag / multitool app, TI hardware) to attempt to isolate the issue.