Skip to content

Commit

Permalink
Use isMultipleAdvertisementSupported to check whether `PeripheralMa…
Browse files Browse the repository at this point in the history
…nager` is supported on this device, closes #83 (#85)

* Use `isMultipleAdvertisementSupported` to check whether `PeripheralManager` is supported on this device.

* 6.0.2

* 6.0.2

---------

Co-authored-by: yanshouwang <[email protected]>
  • Loading branch information
yanshouwang and yanshouwang authored Jun 30, 2024
1 parent c9f0e7e commit 78e74f7
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions bluetooth_low_energy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.0.2

* `Android` [Use `isMultipleAdvertisementSupported` to check whether `PeripheralManager` is supported on this device.](https://github.com/yanshouwang/bluetooth_low_energy/issues/83).

## 6.0.1

* `Android` Fix the issue that [advertisement name is wrong when advertising](https://github.com/yanshouwang/bluetooth_low_energy/issues/62).
Expand Down
12 changes: 6 additions & 6 deletions bluetooth_low_energy/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ packages:
dependency: transitive
description:
name: bluetooth_low_energy_android
sha256: "97cac5169a392f3872cbb416cc11cf0b2287567c0ceca4d975f2fc5bdd2b1e6f"
sha256: f8cbef16b980f96c09df5d1d46b61be9f05683866151440e9987796607a4e7d8
url: "https://pub.dev"
source: hosted
version: "6.0.2"
version: "6.0.3"
bluetooth_low_energy_darwin:
dependency: transitive
description:
Expand Down Expand Up @@ -205,10 +205,10 @@ packages:
dependency: "direct main"
description:
name: go_router
sha256: "6ad5662b014c06c20fa46ab78715c96b2222a7fe4f87bf77e0289592c2539e86"
sha256: cdae1b9c8bd7efadcef6112e81c903662ef2ce105cbd220a04bbb7c3425b5554
url: "https://pub.dev"
source: hosted
version: "14.1.3"
version: "14.2.0"
hybrid_logging:
dependency: "direct main"
description:
Expand Down Expand Up @@ -290,10 +290,10 @@ packages:
dependency: "direct main"
description:
name: material_symbols_icons
sha256: b2d3cbc3c42b8a217715b0d97ff03aebb14b2b4592875736e5599c603fb2db7e
sha256: a2c78726048c755f0f90fd2b7c8799cd94338e2e9b7ab6498ae56503262c14bc
url: "https://pub.dev"
source: hosted
version: "4.2758.0"
version: "4.2762.0"
meta:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions bluetooth_low_energy/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bluetooth_low_energy
description: "A Flutter plugin for controlling the bluetooth low energy, supports central and peripheral roles."
version: 6.0.1
version: 6.0.2
homepage: https://github.com/yanshouwang/bluetooth_low_energy
repository: https://github.com/yanshouwang/bluetooth_low_energy
issue_tracker: https://github.com/yanshouwang/bluetooth_low_energy/issues
Expand All @@ -20,7 +20,7 @@ dependencies:
flutter:
sdk: flutter
bluetooth_low_energy_platform_interface: ^6.0.0
bluetooth_low_energy_android: ^6.0.2
bluetooth_low_energy_android: ^6.0.3
bluetooth_low_energy_darwin: ^6.0.0
bluetooth_low_energy_windows: ^6.0.0
bluetooth_low_energy_linux: ^6.0.0
Expand Down
4 changes: 4 additions & 0 deletions bluetooth_low_energy_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.0.3

* [Use `isMultipleAdvertisementSupported` to check whether `PeripheralManager` is supported on this device.](https://github.com/yanshouwang/bluetooth_low_energy/issues/83).

## 6.0.2

* Fix the warning issue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ class MyPeripheralManager(context: Context, binaryMessenger: BinaryMessenger) :
}

override fun getState(): MyBluetoothLowEnergyStateArgs {
val supported = context.packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)
// Use isMultipleAdvertisementSupported() to check whether LE Advertising is supported on this device before calling this method.
// See https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothAdapter#getbluetoothleadvertiser
val supported = context.packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) && adapter.isMultipleAdvertisementSupported
return if (supported) {
val authorized = permissions.all { permission -> ActivityCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED }
return if (authorized) adapter.state.toBluetoothLowEnergyStateArgs()
Expand Down
2 changes: 1 addition & 1 deletion bluetooth_low_energy_android/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages:
path: ".."
relative: true
source: path
version: "6.0.2"
version: "6.0.3"
bluetooth_low_energy_platform_interface:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion bluetooth_low_energy_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bluetooth_low_energy_android
description: "Android implementation of the bluetooth_low_energy plugin."
version: 6.0.2
version: 6.0.3
homepage: https://github.com/yanshouwang/bluetooth_low_energy
repository: https://github.com/yanshouwang/bluetooth_low_energy
issue_tracker: https://github.com/yanshouwang/bluetooth_low_energy/issues
Expand Down

0 comments on commit 78e74f7

Please sign in to comment.