Use isMultipleAdvertisementSupported to check whether PeripheralManager 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 <yanshouwang@outlook.com>
This commit is contained in:
渐渐被你吸引
2024-06-30 20:17:57 +08:00
committed by GitHub
parent c9f0e7e5ee
commit 78e74f7793
7 changed files with 21 additions and 11 deletions

View File

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

View File

@ -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:
@ -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:
@ -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:

View File

@ -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
@ -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

View File

@ -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.

View File

@ -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()

View File

@ -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:

View File

@ -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