¿Cómo resolver el error BluetoothGatt: android.os.DeadObjectException ocurrido en Android?

Sigo la paginaBluetooth de baja energía para desarrollar enAndroid 4.3 paraBluetooth de baja energía .

Ya puedo encender el Bluetooth, escanear el dispositivo y conectarme al dispositivo BLE.

Pero muestra elBluetoothGatt : android.os.DeadObjectException después de que trato deconectarse al dispositivo(device.connectGatt) yantes de descubrir el servicio (mBluetoothGatt.discoverServices) para el dispositivo BLE.

antes deBluetoothGatt : android.os.DeadObjectException muestra el registro como el siguiente

W/bt-smp  (10670): io_cap = 4
W/bt-smp  (10670): new io_cap = 4 p_cb->loc_enc_size = 16
W/BluetoothEventManager( 7380): CachedBluetoothDevice for device 20:73:20:00:6C:B4 not found, calling readPairedDevices().
D/BluetoothAdapterService(1108123608)(10670): Get Bonded Devices being called
E/BluetoothEventManager( 7380): Got bonding state changed for 20:73:20:00:6C:B4, but we have no record of that device.

El registro completo cuando yoconectarse al dispositivo BLE antes de descubrir el Servicio es como el siguiente

I/BluetoothLeService(10888): BluetoothGattCallback-----newState = 2
I/BluetoothLeService(10888): STATE_CONNECTED:
I/Device_information(10888): BroadcastReceiver---action = ti.android.ble.common.ACTION_GATT_CONNECTED
W/qdhwcomposer(  326): Excessive delay reading vsync: took 816 ms
I/BluetoothBondStateMachine(10670): Bond address is:20:73:20:00:6C:B4
I/BluetoothBondStateMachine(10670): Entering PendingCommandState State
I/BluetoothBondStateMachine(10670): bondStateChangeCallback: Status: 0 Address: 20:73:20:00:6C:B4 newState: 1
D/BluetoothAdapterService(1108123608)(10670): Get Bonded Devices being called
I/BluetoothBondStateMachine(10670): Bond State Change Intent:20:73:20:00:6C:B4 OldState: 10 NewState: 11
W/bt-smp  (10670): io_cap = 4
W/bt-smp  (10670): new io_cap = 4 p_cb->loc_enc_size = 16
W/BluetoothEventManager( 7380): CachedBluetoothDevice for device 20:73:20:00:6C:B4 not found, calling readPairedDevices().
D/BluetoothAdapterService(1108123608)(10670): Get Bonded Devices being called
E/BluetoothEventManager( 7380): Got bonding state changed for 20:73:20:00:6C:B4, but we have no record of that device.
E/BluetoothGatt( 8804): 
E/BluetoothGatt( 8804): android.os.DeadObjectException
E/BluetoothGatt( 8804):     at android.os.BinderProxy.transact(Native Method)
E/BluetoothGatt( 8804):     at android.bluetooth.IBluetoothGatt$Stub$Proxy.clientConnect(IBluetoothGatt.java:739)
E/BluetoothGatt( 8804):     at android.bluetooth.BluetoothGatt.connect(BluetoothGatt.java:715)
E/BluetoothGatt( 8804):     at com.sonyericsson.extras.liveware.aas.AasGatt.connect(AasGatt.java:144)
E/BluetoothGatt( 8804):     at com.sonyericsson.extras.liveware.aas.AasGatt.onStartCommand(AasGatt.java:105)
E/BluetoothGatt( 8804):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2768)
E/BluetoothGatt( 8804):     at android.app.ActivityThread.access$1900(ActivityThread.java:150)
E/BluetoothGatt( 8804):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1395)
E/BluetoothGatt( 8804):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/BluetoothGatt( 8804):     at android.os.Looper.loop(Looper.java:213)
E/BluetoothGatt( 8804):     at android.app.ActivityThread.main(ActivityThread.java:5225)
E/BluetoothGatt( 8804):     at java.lang.reflect.Method.invokeNative(Native Method)
E/BluetoothGatt( 8804):     at java.lang.reflect.Method.invoke(Method.java:525)
E/BluetoothGatt( 8804):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
E/BluetoothGatt( 8804):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
E/BluetoothGatt( 8804):     at dalvik.system.NativeStart.main(Native Method)
D/BluetoothGatt( 8804): connect() - device: 20:73:20:00:6C:B4, auto: false
D/BluetoothGatt( 8804): registerApp()
D/BluetoothGatt( 8804): registerApp() - UUID=3a123b89-8939-4d5b-ae6b-3ca1d98b4208
D/BtGatt.GattService(10670): registerClient() - UUID=3a123b89-8939-4d5b-ae6b-3ca1d98b4208
D/BtGatt.btif(10670): btif_gattc_register_app
D/BtGatt.btif(10670): btgattc_handle_event: Event 1000
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 0
D/BtGatt.GattService(10670): onClientRegistered() - UUID=3a123b89-8939-4d5b-ae6b-3ca1d98b4208, clientIf=5
E/MP-Decision( 2172): Error setting a sleep mode for secondary cores - -38
D/BluetoothGatt( 8804): onClientRegistered() - status=0 clientIf=5
D/BtGatt.GattService(10670): clientConnect() - address=20:73:20:00:6C:B4, isDirect=true
D/BtGatt.btif(10670): btif_gattc_open
D/BtGatt.btif(10670): btgattc_handle_event: Event 1004
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 2
D/BtGatt.GattService(10670): onConnected() - clientIf=5, connId=5, address=20:73:20:00:6C:B4
D/BluetoothGatt( 8804): onClientConnectionState() - status=0 clientIf=5 device=20:73:20:00:6C:B4
D/BluetoothGatt( 8804): discoverServices() - device: 20:73:20:00:6C:B4
D/BtGatt.GattService(10670): discoverServices() - address=20:73:20:00:6C:B4, connId=5
D/BtGatt.btif(10670): btif_gattc_search_service
D/BtGatt.btif(10670): btgattc_handle_event: Event 1006
V/BluetoothMasReceiver( 8128): BluetoothMasReceiver onReceive :android.bluetooth.device.action.BOND_STATE_C,HANGED
V/BluetoothMasService( 8128): Map Service onStartCommand
V/BluetoothMasService( 8128): action: android.bluetooth.device.action.BOND_STATE_CHANGED
W/bt-smp  (10670): local rand(LSB ~ MSB) = 86 fe b8 98 d9 17 ec 85 11 5c 06 18 19 72 99 cf 
W/bt-smp  (10670): P1(LSB ~ MSB) = 00 00 01 04 00 05 10 07 07 02 03 00 01 10 07 07 
W/bt-smp  (10670): P1' = r XOR p1(LSB ~ MSB) = 86 fe b9 9c d9 12 fc 82 16 5e 05 18 18 62 9e c8 
W/bt-smp  (10670): Key(LSB ~ MSB) = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = 86 fe b9 9c d9 12 fc 82 16 5e 05 18 18 62 9e c8 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = 09 51 07 24 65 d0 6d a0 b2 63 57 aa 60 28 29 ba 
W/bt-smp  (10670): C1(LSB ~ MSB) = 09 51 07 24 65 d0 6d a0 b2 63 57 aa 60 28 29 ba 
W/bt-smp  (10670): p2(LSB ~ MSB) = b4 6c 00 20 73 20 c5 93 40 62 51 d0 00 00 00 00 
W/bt-smp  (10670): p2' = C1 xor p2(LSB ~ MSB) = bd 3d 07 04 16 f0 a8 33 f2 01 06 7a 60 28 29 ba 
W/bt-smp  (10670): Key(LSB ~ MSB) = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = bd 3d 07 04 16 f0 a8 33 f2 01 06 7a 60 28 29 ba 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = 20 4b 2b ab 92 cb 79 81 68 de 9e 62 d5 ac 4c 7b 
W/bt-smp  (10670): Confirm(LSB ~ MSB) = 20 4b 2b ab 92 cb 79 81 68 de 9e 62 d5 ac 4c 7b 
D/BluetoothMasService( 8128): device: HelloFH
W/bt-smp  (10670): peer rand(LSB ~ MSB) = 41 8d 98 57 20 2d 8f 51 18 93 4e cf 48 39 ac cf 
W/bt-smp  (10670): P1(LSB ~ MSB) = 00 00 01 04 00 05 10 07 07 02 03 00 01 10 07 07 
W/bt-smp  (10670): P1' = r XOR p1(LSB ~ MSB) = 41 8d 99 53 20 28 9f 56 1f 91 4d cf 49 29 ab c8 
W/bt-smp  (10670): Key(LSB ~ MSB) = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = 41 8d 99 53 20 28 9f 56 1f 91 4d cf 49 29 ab c8 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = b2 4c b9 c1 65 2b ec 8f 86 74 82 4b d3 ca c6 9f 
W/bt-smp  (10670): C1(LSB ~ MSB) = b2 4c b9 c1 65 2b ec 8f 86 74 82 4b d3 ca c6 9f 
W/bt-smp  (10670): p2(LSB ~ MSB) = b4 6c 00 20 73 20 c5 93 40 62 51 d0 00 00 00 00 
W/bt-smp  (10670): p2' = C1 xor p2(LSB ~ MSB) = 06 20 b9 e1 16 0b 29 1c c6 16 d3 9b d3 ca c6 9f 
W/bt-smp  (10670): Key(LSB ~ MSB) = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = 06 20 b9 e1 16 0b 29 1c c6 16 d3 9b d3 ca c6 9f 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = 04 9a 63 ea a0 fb 6d 9e 91 70 65 6d 54 26 d0 e1 
W/bt-smp  (10670): Compare(LSB ~ MSB) = 04 9a 63 ea a0 fb 6d 9e 91 70 65 6d 54 26 d0 e1 
W/bt-smp  (10670): Key(LSB ~ MSB) = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = 86 fe b8 98 d9 17 ec 85 41 8d 98 57 20 2d 8f 51 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = 4a 97 52 da 4f ac 7e 4b 48 f1 ba 33 0d df 6f 72 
E/bt-smp  (10670): STK Generated
W/bt-smp  (10670): Key(LSB ~ MSB) = 5e b8 49 86 94 c9 24 d3 79 10 96 8d f0 fa d6 df 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = c9 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = dc 0b 54 34 a5 ff f1 6d 69 91 af f4 77 dd 44 09 
W/bt-smp  (10670): Key(LSB ~ MSB) = 67 e6 91 62 7a 0d 29 34 59 17 92 d8 8d 9b fa 89 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = d6 ec 85 b8 8c 5f 22 32 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = cd 25 9e e0 c7 c3 c2 fe 1a 7e 2c 58 01 fa 97 17 
E/bt-smp  (10670): LTK ready
W/bt-smp  (10670): smp_send_enc_info
W/bt-smp  (10670): smp_send_id_info
W/bt-smp  (10670): Key(LSB ~ MSB) = 5e b8 49 86 94 c9 24 d3 79 10 96 8d f0 fa d6 df 
W/bt-smp  (10670): Plain text(LSB ~ MSB) = c9 51 01 00 00 00 00 00 00 00 00 00 00 00 00 00 
W/bt-smp  (10670): Encrypted text(LSB ~ MSB) = 56 68 2a c9 e3 c8 b8 b8 97 5c fd e8 60 93 76 66 
D/Diag_Lib(  507): [IMS_DEBUG]| 1035 | 535 |qpNetSelect : Select Unblocked , iRtn 0, errno 0, errno [Success]
E/Diag_Lib(  507): [IMS_FATAL]| 251 | 535 |qvp_rtp_handle_signals iRet : 0
E/Diag_Lib(  507): [IMS_FATAL]| 238 | 535 |qvp_rtp_handle_signals qpDplMainLoop: Calling imsSignalHandler
D/Diag_Lib(  507): [IMS_DEBUG]| 144 | 535 |qpDpl:imsSignalHandler
E/Diag_Lib(  507): [IMS_FATAL]| 155 | 535 |qpdpl:imsSignalHandler: GLobal data NULL or Event list size is 0
E/Diag_Lib(  507): [IMS_FATAL]| 243 | 535 |qvp_rtp_handle_signals add read fd : 8
E/bt-btif (10670): No More Service found
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 7
D/BtGatt.GattService(10670): onSearchResult() - address=20:73:20:00:6C:B4, uuid=00001801-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 8804): onGetService() - Device=20:73:20:00:6C:B4 UUID=00001801-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 7
D/BtGatt.GattService(10670): onSearchResult() - address=20:73:20:00:6C:B4, uuid=00001800-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 8804): onGetService() - Device=20:73:20:00:6C:B4 UUID=00001800-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 7
D/BtGatt.GattService(10670): onSearchResult() - address=20:73:20:00:6C:B4, uuid=1b7e8251-2877-41c3-b46e-cf057c562023
D/BluetoothGatt( 8804): onGetService() - Device=20:73:20:00:6C:B4 UUID=1b7e8251-2877-41c3-b46e-cf057c562023
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 7
D/BtGatt.GattService(10670): onSearchResult() - address=20:73:20:00:6C:B4, uuid=0000180a-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 8804): onGetService() - Device=20:73:20:00:6C:B4 UUID=0000180a-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 7
D/BtGatt.GattService(10670): onSearchResult() - address=20:73:20:00:6C:B4, uuid=0000180f-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 8804): onGetService() - Device=20:73:20:00:6C:B4 UUID=0000180f-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 6
D/BtGatt.GattService(10670): onSearchCompleted() - connId=5, status=0
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1007
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=133, charUuid=5e0dae24-5e0d-adf0-409b-a23f420d6580, prop=94
D/BtGatt.btif(10670): btif_gattc_get_included_service
D/BtGatt.btif(10670): btgattc_handle_event: Event 1011
E/BtGatt.btif(10670): bta_to_btif_uuid: Unknown UUID length 24028!
D/BtGatt.GattService(10670): onGetIncludedService() - address=20:73:20:00:6C:B4, status=133, uuid=00001801-0000-1000-8000-00805f9b34fb, inclUuid=5e0dae24-5e0d-adf0-409b-a23f420d6580
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1007
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=00002a00-0000-1000-8000-00805f9b34fb, prop=2
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=00002a00-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=00002a01-0000-1000-8000-00805f9b34fb, prop=2
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=00002a01-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=133, charUuid=00002a01-0000-1000-8000-00805f9b34fb, prop=2
D/BtGatt.btif(10670): btif_gattc_get_included_service
I/bt-hci  (10670): BLE HCI(id=62) event = 0x03)
I/bt-hci  (10670): btu_ble_ll_conn_param_upd_evt
D/BtGatt.btif(10670): btgattc_handle_event: Event 1011
D/BtGatt.GattService(10670): onGetIncludedService() - address=20:73:20:00:6C:B4, status=133, uuid=00001800-0000-1000-8000-00805f9b34fb, inclUuid=00002a01-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1007
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=8ac32d3f-5cb9-4d44-bec2-ee689169f626, prop=50
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=8ac32d3f-5cb9-4d44-bec2-ee689169f626
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=5e9bf2a8-f93f-4481-a67e-3b2f4a07891a, prop=10
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=5e9bf2a8-f93f-4481-a67e-3b2f4a07891a
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=d5b8304c-076a-42ce-9d1e-1c859336363f, prop=50
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=d5b8304c-076a-42ce-9d1e-1c859336363f
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=f4bfe056-701d-4af7-a326-d2ecd00173f4, prop=10
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=f4bfe056-701d-4af7-a326-d2ecd00173f4
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=b1736a91-c910-4ad2-ab3a-fd72cc55903d, prop=10
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=b1736a91-c910-4ad2-ab3a-fd72cc55903d
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=ff890e61-5600-4426-88cf-090abe01d0b8, prop=10
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=ff890e61-5600-4426-88cf-090abe01d0b8
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=74de75ce-03b7-4e62-84d0-0d229d456836, prop=10
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=74de75ce-03b7-4e62-84d0-0d229d456836
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=133, charUuid=74de75ce-03b7-4e62-84d0-0d229d456836, prop=10
D/BtGatt.btif(10670): btif_gattc_get_included_service
D/BtGatt.btif(10670): btgattc_handle_event: Event 1011
D/BtGatt.GattService(10670): onGetIncludedService() - address=20:73:20:00:6C:B4, status=133, uuid=1b7e8251-2877-41c3-b46e-cf057c562023, inclUuid=74de75ce-03b7-4e62-84d0-0d229d456836
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1007
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=00002a29-0000-1000-8000-00805f9b34fb, prop=2
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=00002a29-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=00002a24-0000-1000-8000-00805f9b34fb, prop=2
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=00002a24-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=00002a23-0000-1000-8000-00805f9b34fb, prop=2
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=00002a23-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=133, charUuid=00002a23-0000-1000-8000-00805f9b34fb, prop=2
D/BtGatt.btif(10670): btif_gattc_get_included_service
D/BtGatt.btif(10670): btgattc_handle_event: Event 1011
D/BtGatt.GattService(10670): onGetIncludedService() - address=20:73:20:00:6C:B4, status=133, uuid=0000180a-0000-1000-8000-00805f9b34fb, inclUuid=00002a23-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1007
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=0, charUuid=00002a19-0000-1000-8000-00805f9b34fb, prop=2
D/BluetoothGatt( 8804): onGetCharacteristic() - Device=20:73:20:00:6C:B4 UUID=00002a19-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_characteristic
D/BtGatt.btif(10670): btgattc_handle_event: Event 1008
D/BtGatt.GattService(10670): onGetCharacteristic() - address=20:73:20:00:6C:B4, status=133, charUuid=00002a19-0000-1000-8000-00805f9b34fb, prop=2
D/BtGatt.btif(10670): btif_gattc_get_included_service
D/BtGatt.btif(10670): btgattc_handle_event: Event 1011
D/BtGatt.GattService(10670): onGetIncludedService() - address=20:73:20:00:6C:B4, status=133, uuid=0000180f-0000-1000-8000-00805f9b34fb, inclUuid=00002a19-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_descriptor
D/BtGatt.btif(10670): btgattc_handle_event: Event 1009
D/BtGatt.GattService(10670): onGetDescriptor() - address=20:73:20:00:6C:B4, status=133, descUuid=00002a19-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_descriptor
D/BtGatt.btif(10670): btgattc_handle_event: Event 1009
D/BtGatt.GattService(10670): onGetDescriptor() - address=20:73:20:00:6C:B4, status=133, descUuid=00002a19-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_descriptor
D/BtGatt.btif(10670): btgattc_handle_event: Event 1009
D/BtGatt.GattService(10670): onGetDescriptor() - address=20:73:20:00:6C:B4, status=0, descUuid=00002902-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 8804): onGetDescriptor() - Device=20:73:20:00:6C:B4 UUID=00002902-0000-1000-8000-00805f9b34fb
D/BtGatt.btif(10670): btif_gattc_get_descriptor
D/BtGatt.btif(10670): btgattc_handle_event: Event 1010

No estoy seguro de por quéE/BluetoothGatt( 8804): android.os.DeadObjectException sucedió Después de que ocurriera este error, no puedo descubrir el servicio para el dispositivo BLE cuando ejecutomBluetoothGatt.discoverServices.

Tengo que desconectar y volver a conectar al dispositivo BLE nuevamente. Y funciona bien.

Si yolimpie los datos para Bluetooth en la configuración de Android y vuelva a conectarse al dispositivo BLE. El error volvió a ocurrir ...

Y en algún momento se desconectará inmediatamente después de conectarme, así que tengo que volver a conectarme.

¿Alguien tiene el mismo error o condición? Por favor, ayúdame o enséñame cómo resolver este problema, se confundió unos días ...

¡Gracias por adelantado!-------------------------------------------------- EDITAR-----------------------------------------------

El código del Servicio es el siguiente:

paquete com.ampak.pace;

public class BluetoothLeService extends Service{

      static final String TAG = "BluetoothLeService";
      private static BluetoothAdapter mBluetoothAdapter = null;
      private static BluetoothManager mBluetoothManager = null;
      private BluetoothGatt mBluetoothGatt = null;
      private String mBluetoothDeviceAddress;
      private BluetoothDevice device;
      public static String address = null;
      public static Handler handler=new Handler(Looper.getMainLooper());
    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {

        public void onConnectionStateChange(android.bluetooth.BluetoothGatt gatt, int status, int newState) {
            if(mBluetoothGatt == null){
                Log.e(TAG, "mBluetoothGatt not created!");
                return;
            }

            device = gatt.getDevice();
            address = device.getAddress();

            try {
                switch (newState) {
                case BluetoothAdapter.STATE_CONNECTED:

                    Log.i(TAG, "STATE_CONNECTED:");
                    broadcastUpdate(ACTION_GATT_CONNECTED, device, status);     
                    break;
                case BluetoothAdapter.STATE_DISCONNECTED:
                    Log.i(TAG, "STATE_DISCONNECTED:");
                    gatt.close();
                    broadcastUpdate(ACTION_GATT_DISCONNECTED, device, status);
                    break;

                default:
                    Log.i(TAG, "New state not processed: " + newState);
                    break;
                }
            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }


        public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
            if(status == BluetoothGatt.GATT_SUCCESS) {
            }
        };

        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            if(status == BluetoothGatt.GATT_SUCCESS){
                Log.i(TAG, "onServicesDiscovered-----GATT_SUCCESS@@@@@@ = ");
            }
        };
    };


    private void broadcastUpdate(final String action, final BluetoothDevice device , final int status) {
        // TODO Auto-generated method stub
        final Intent intent = new Intent(action);
        intent.putExtra(EXTRA_UUID, device);
        intent.putExtra(EXTRA_STATUS, status);

        sendBroadcast(intent);
    }

    public boolean initialize() {
        // TODO Auto-generated method stub
        if(mBluetoothManager == null){
            Log.e(TAG, "BluetoothManager initialize@@@");
            mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
            if(mBluetoothManager == null){
                Log.e(TAG, "Unable to initialize BluetoothManager");
                  return false;
            }
        }

        mBluetoothAdapter = mBluetoothManager.getAdapter();
        if(mBluetoothAdapter == null){
            Log.e(TAG, "Unable to obtain a BluetoothAdapter");
            return false;
        }
        return true;    
    }

    public void connect(final String address) {
        // TODO Auto-generated method stub
        Log.w(TAG, "BluetoothLeService Connect function.");
        if(mBluetoothAdapter == null || address == null){
            Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
        }

        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
        int connectState = mBluetoothManager.getConnectionState(device, BluetoothProfile.GATT);

        mBluetoothGatt = device.connectGatt(this, true, mGattCallback); 

    }

    public void disconnect(String address) {
        // TODO Auto-generated method stub
        if(mBluetoothAdapter == null){
            Log.w(TAG, "disconnect: BluetoothAdapter not initialized");
              return;
        }

        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
        int connectionState = mBluetoothManager.getConnectionState(device, BluetoothProfile.GATT);

        if(mBluetoothGatt != null){
            Log.i(TAG, "disconnect");
            if(connectionState != BluetoothProfile.STATE_DISCONNECTED){
                mBluetoothGatt.disconnect();
            }else{
                Log.w(TAG, "Attempt to disconnect in state: " + connectionState);
            }
        }   
    }




    @Override
    public void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
    }

    //private final IBinder binder = new LocalBinder();
    private final LocalBinder binder = new LocalBinder();
    public class LocalBinder extends Binder{
        public BluetoothLeService getService() {
            return BluetoothLeService.this;
        }
    }


    @Override
    public IBinder onBind(Intent intent) {
        // TODO Auto-generated method stub
        return binder;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        // TODO Auto-generated method stub
        Log.i(TAG, "onUnbind");
        close();
        return super.onUnbind(intent);
    }

    public void close() {
        // TODO Auto-generated method stub
        if (mBluetoothGatt != null) {
            mBluetoothGatt.close();
            mBluetoothGatt = null;
        }
    }       
}

Respuestas a la pregunta(4)

Su respuesta a la pregunta