quick_blue icon indicating copy to clipboard operation
quick_blue copied to clipboard

[Android]PlatformException(Characteristic unavailable, null, null, null)

Open ankita-kanchan opened this issue 2 years ago • 6 comments

quick blue irregularly throws this PlatformException(Characteristic unavailable, null, null, null)

E/flutter (21750): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Characteristic unavailable, null, null, null) E/flutter (21750): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653) E/flutter (21750): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296) E/flutter (21750):

Does anyone have an idea how I can fix/avoid the exception?

Thanks!

ankita-kanchan avatar Apr 25 '23 11:04 ankita-kanchan

I have found solution when debuging. First we should write descyptor.

QuickBlue.writeValue(
        selectedDeviceAddress!.address!,
        uuidEEG,
        uuidEEGCtrl,
        Uint8List.fromList([0x01, 0x01]),
        BleOutputProperty.withResponse,
      ).

Next we call setNotifiable but there should be a timeout... I took 1 sec. So this works for me:

      QuickBlue.writeValue(
        selectedDeviceAddress!.address!,
        uuid1,
        uuid2,
        Uint8List.fromList([0x01, 0x01]),
        BleOutputProperty.withResponse,
      ).then((value) => {
            Timer(
                Duration(milliseconds: 1000),
                () => {
                      QuickBlue.setNotifiable(
                        selectedDeviceAddress!.address!,
                              uuid1,
                                uuid3,
                        BleInputProperty.notification,
                      ).then((value) => {}),
                    }),
          });

GorIvanov avatar Jun 08 '23 14:06 GorIvanov

@ankita-kanchan hey , Ankita can u provide a running example for this package in android . It's urgent. I am unable to run this package on android

SahilSharma2710 avatar Jun 19 '23 11:06 SahilSharma2710

Seconded on the example! I can't seem to get this to work on Android either.

ethmth avatar Jun 20 '23 01:06 ethmth

@ethmth i am able to run this package on android now This following repo was helpful https://github.com/MatheusJulidori/dart-flutter/tree/main/bluetooth_app

SahilSharma2710 avatar Jun 20 '23 09:06 SahilSharma2710

@ethmth i am able to run this package on android now This following repo was helpful https://github.com/MatheusJulidori/dart-flutter/tree/main/bluetooth_app

Thank you. Unfortunately that example doesn't seem to include readValue/writeValue/setNotifiable, which is where I'm having trouble.

ethmth avatar Jun 20 '23 12:06 ethmth

@ethmthcan you update me once if u got any solution of ur problem , i am having same issues.

SahilSharma2710 avatar Jun 21 '23 05:06 SahilSharma2710