Skip to content

Commit f420def

Browse files
committed
Prepare release of 3.0.0-beta
1 parent ca72656 commit f420def

File tree

7 files changed

+54
-4
lines changed

7 files changed

+54
-4
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.0.0-beta
2+
3+
* **BREAKING** Migrate Android implementation to RxAndroidBle2
4+
This might require the user to implement a global error handler https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling
5+
See more: https://github.com/Polidea/RxAndroidBle/wiki/FAQ:-UndeliverableException
6+
17
## 2.3.1
28

39
* Fix connection timeout on iOS

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,45 @@ Support for Bluetooth Low Energy has been added in API 18, hence the library req
3636

3737
**Notice:** You don't need to add any permissions related to BLE to the `AndroidManifest.xml`, because they are already declared in the library's native module. However, you still need to request `ACCESS_FINE_LOCATION` permission at runtime to be able to scan for peripheral. See [example's code](https://github.com/Polidea/FlutterBleLib/blob/202c6fe48300be207f80567ca4bee5b6fbc83eb5/example/lib/devices_list/devices_bloc.dart#L80) and [example's pubspec](https://github.com/Polidea/FlutterBleLib/blob/202c6fe48300be207f80567ca4bee5b6fbc83eb5/example/pubspec.yaml#L20).
3838

39+
This library is using RxJava 2. Because of a difference in error handling between RxJava 1 and 2,
40+
your/your user's application might encounter globally rethrown errors that were encountered after their consumer has finished its lifecycle.
41+
[Read more here](https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling)
42+
and [specifically about RxAndroidBle2 here](https://github.com/Polidea/RxAndroidBle/wiki/FAQ:-UndeliverableException)
43+
44+
Recommended configuration is as follows.
45+
46+
`app/build.gradle`:
47+
48+
```groovy
49+
...
50+
dependencies {
51+
...
52+
implementation 'io.reactivex.rxjava2:rxjava:2.2.17'
53+
...
54+
}
55+
```
56+
57+
`MainActivity.java`:
58+
59+
```dart
60+
...
61+
import io.reactivex.functions.Consumer;
62+
import io.reactivex.plugins.RxJavaPlugins;
63+
64+
public class MainActivity extends FlutterActivity {
65+
@Override
66+
protected void onCreate(Bundle savedInstanceState) {
67+
...
68+
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
69+
@Override
70+
public void accept(Throwable throwable) throws Exception {
71+
Log.w("GlobalErrorHandler", throwable);
72+
}
73+
});
74+
}
75+
}
76+
```
77+
(feel free to replace consumer with a lambda)
3978
### iOS
4079

4180
Go to `[project]/ios` directory and run `pod install`.

android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ android {
3636

3737
dependencies {
3838
implementation 'androidx.annotation:annotation:1.1.0'
39-
implementation 'com.github.Polidea:MultiPlatformBleAdapter:0.1.7'
39+
implementation 'com.github.Polidea:MultiPlatformBleAdapter:1.0.0-beta'
4040
}

example/android/app/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ flutter {
6565

6666
dependencies {
6767
testImplementation 'junit:junit:4.12'
68+
implementation 'io.reactivex.rxjava2:rxjava:2.2.17'
6869
androidTestImplementation 'androidx.test:runner:1.2.0'
6970
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
7071
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package com.polidea.flutter_ble_lib_example;
22

33
import android.os.Bundle;
4+
import android.util.Log;
5+
46
import io.flutter.app.FlutterActivity;
57
import io.flutter.plugins.GeneratedPluginRegistrant;
8+
import io.reactivex.plugins.RxJavaPlugins;
69

710
public class MainActivity extends FlutterActivity {
811
@Override
912
protected void onCreate(Bundle savedInstanceState) {
1013
super.onCreate(savedInstanceState);
1114
GeneratedPluginRegistrant.registerWith(this);
15+
RxJavaPlugins.setErrorHandler(throwable -> Log.w("GlobalErrorHandler", throwable));
1216
}
1317
}

ios/flutter_ble_lib.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
Pod::Spec.new do |s|
55
s.name = 'flutter_ble_lib'
6-
s.version = '2.3.1'
6+
s.version = '3.0.0-beta'
77
s.summary = 'A new flutter plugin project.'
88
s.description = <<-DESC
99
A new flutter plugin project.
@@ -16,7 +16,7 @@ A new flutter plugin project.
1616
s.public_header_files = 'Classes/**/*.h'
1717
s.dependency 'Flutter'
1818
s.swift_versions = ['4.0', '4.2', '5.0']
19-
s.dependency 'MultiplatformBleAdapter', '~> 0.1.7'
19+
s.dependency 'MultiplatformBleAdapter', '~> 1.0.0-beta'
2020

2121
s.ios.deployment_target = '8.0'
2222
end

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_ble_lib
22
description: FlutterBle Library is a flutter library that supports BLE operations. It uses MultiPlatformBleAdapter as a native backend..
3-
version: 2.3.1
3+
version: 3.0.0-beta
44
homepage: https://github.com/Polidea/FlutterBleLib
55

66
environment:

0 commit comments

Comments
 (0)