You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? (please describe)
The ReadMe section for Ble Undeliverable Exception should contain a complete working code sample and some more detailed instructions.
Describe the solution you'd like
To catch the Ble Undeliverable exception in Java you can do the following . . .
Add implementation "com.polidea.rxandroidble2:rxandroidble:1.11.1" to the dependencies section of your build.gradle file (source).
Then add the following to MainActivity.java
importio.flutter.embedding.android.FlutterActivity;
importandroidx.annotation.NonNull;
importio.flutter.embedding.android.FlutterActivity;
importio.flutter.embedding.engine.FlutterEngine;
importcom.polidea.rxandroidble2.exceptions.BleException;
importio.reactivex.exceptions.UndeliverableException;
importio.reactivex.plugins.RxJavaPlugins;
publicclassMainActivityextendsFlutterActivity {
publicvoidconfigureFlutterEngine(@NonNullFlutterEngineflutterEngine) {
super.configureFlutterEngine(flutterEngine);
RxJavaPlugins.setErrorHandler(throwable -> {
if (throwableinstanceofUndeliverableException && throwable.getCause() instanceofBleException) {
System.out.println('!' * 80);
System.out.println("Caught UndeliverableException from flutter_reactive_ble.");
System.out.println('!' * 80);
return; // ignore BleExceptions as they were surely delivered at least once
}
thrownewRuntimeException("Unexpected Throwable in RxJavaPlugins error handler", throwable);
});
}
}
Additional context
As for me, my experience with android is limited and so it took me a long time to build a complete working version from the code you had in your README. Also, you can find some helpful examples here in the RxAndroidBle library examples folder.
The text was updated successfully, but these errors were encountered:
@0p3r4t0r thanks for reporting. I indeed see that I forgot to add the need for adding the polidea library in this example. Regarding the rest of the code you are working in java and my example was written in Kotlin. Will make that more clear as well. For the rest the issue is not on the RxAndroid library but more on the RXJava side so adding the RXAndroidBLE examples do not add that much value.
How about providing some links to the relevant sections of the RxAndroid library? That way you wouldn't clutter your docs and you could probably save your users some Googling.
Is your feature request related to a problem? (please describe)
The ReadMe section for Ble Undeliverable Exception should contain a complete working code sample and some more detailed instructions.
Describe the solution you'd like
To catch the
Ble Undeliverable
exception in Java you can do the following . . .Add
implementation "com.polidea.rxandroidble2:rxandroidble:1.11.1"
to the dependencies section of your build.gradle file (source).Then add the following to MainActivity.java
Additional context
As for me, my experience with android is limited and so it took me a long time to build a complete working version from the code you had in your README. Also, you can find some helpful examples here in the RxAndroidBle library examples folder.
The text was updated successfully, but these errors were encountered: