Skip to content

Commit

Permalink
Prepare release of 3.0.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolak committed Dec 11, 2020
1 parent ca72656 commit b6fa1e1
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 3.0.0-beta

* **BREAKING** Migrate Android implementation to RxAndroidBle2
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
See more: https://github.com/Polidea/RxAndroidBle/wiki/FAQ:-UndeliverableException

## 2.3.1

* Fix connection timeout on iOS
Expand Down
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,46 @@ Support for Bluetooth Low Energy has been added in API 18, hence the library req

**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).

### iOS
This library is using RxJava 2. Because of a difference in error handling between RxJava 1 and 2,
your/your user's application might encounter globally rethrown errors that were encountered after their consumer has finished its lifecycle.
[Read more here](https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling)
and [specifically about RxAndroidBle2 here](https://github.com/Polidea/RxAndroidBle/wiki/FAQ:-UndeliverableException)

Recommended configuration is as follows.

`app/build.gradle`:

```groovy
...
dependencies {
...
implementation 'io.reactivex.rxjava2:rxjava:2.2.17'
...
}
```

`MainActivity.java`:

Go to `[project]/ios` directory and run `pod install`.
```dart
...
import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
...
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.w("GlobalErrorHandler", throwable);
}
});
}
}
```
(feel free to replace consumer with a lambda)
### iOS

Add [Privacy - Bluetooth Always Usage Description](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription) key to `[project]/ios/Runner/Info.plist` file.

Expand All @@ -49,6 +86,8 @@ Add [Privacy - Bluetooth Always Usage Description](https://developer.apple.com/d
...
```

Be sure to run `pod repo update` if you have issues with fetching Multiplatform BLE Adapter's pod.

## Usage

The library is organised around a few base entities, which are:
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.polidea.flutter_ble_lib'
version '2.3.1'
version '3.0.0-beta'

buildscript {
repositories {
Expand Down Expand Up @@ -36,5 +36,5 @@ android {

dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.github.Polidea:MultiPlatformBleAdapter:0.1.7'
implementation 'com.github.Polidea:MultiPlatformBleAdapter:1.0.0-beta'
}
1 change: 1 addition & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ flutter {

dependencies {
testImplementation 'junit:junit:4.12'
implementation 'io.reactivex.rxjava2:rxjava:2.2.17'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.polidea.flutter_ble_lib_example;

import android.os.Bundle;
import android.util.Log;

import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.reactivex.plugins.RxJavaPlugins;

public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
RxJavaPlugins.setErrorHandler(throwable -> Log.w("GlobalErrorHandler", throwable));
}
}
4 changes: 2 additions & 2 deletions ios/flutter_ble_lib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
Pod::Spec.new do |s|
s.name = 'flutter_ble_lib'
s.version = '2.3.1'
s.version = '3.0.0-beta'
s.summary = 'A new flutter plugin project.'
s.description = <<-DESC
A new flutter plugin project.
Expand All @@ -16,7 +16,7 @@ A new flutter plugin project.
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.swift_versions = ['4.0', '4.2', '5.0']
s.dependency 'MultiplatformBleAdapter', '~> 0.1.7'
s.dependency 'MultiplatformBleAdapter', '~> 1.0.0-beta'

s.ios.deployment_target = '8.0'
end
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_ble_lib
description: FlutterBle Library is a flutter library that supports BLE operations. It uses MultiPlatformBleAdapter as a native backend..
version: 2.3.1
version: 3.0.0-beta
homepage: https://github.com/Polidea/FlutterBleLib

environment:
Expand Down

0 comments on commit b6fa1e1

Please sign in to comment.