I want to communicate between my HM-10 (BLE) module and my android app. When the app is started, the ble connection is initiated and a dialog, which shows the current connection state, opens.

In my BluetoothGattCallback the onConnectionStateChange is fired correctly, however when I try update the state in the dialog (image and textview), nothing happens. Toast's don't show up either..

I'm opening the connection like this (from the main thread, not in a service or anything):

    public void connect(Context context, BluetoothCallback callback) {
        gatt = device.connectGatt(context, false, callback);
    }

Is the onConnectionStateChange callback still running on a different thread maybe? Hopefully someone can help me out.

Thanks in advance.

Related posts

Recent Viewed