bluetooth
  
Use the Android platform's Bluetooth features with backward-compatible APIs.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
November 29, 2023 - - - 1.0.0-alpha02

Declaring dependencies

To add a dependency on Bluetooth, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    
    implementation "androidx.bluetooth:bluetooth:1.0.0-alpha02"
}

Kotlin

dependencies {
    
    implementation("androidx.bluetooth:bluetooth:1.0.0-alpha02")
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

There are no release notes for this artifact.

Version 1.0

Version 1.0.0-alpha02

November 29, 2023

androidx.bluetooth:bluetooth:1.0.0-alpha02 and androidx.bluetooth:bluetooth-testing:1.0.0-alpha02 are released. Version 1.0.0-alpha02 contains these commits.

New Features

  • Lower minSdkVersion to 21

API Changes

  • GattServerConnectFlow#updateServices becomes a suspend function (I0237d)
  • Change AdvertiseParams.durationMillis to Long (If6771)
  • Convert openGattServer to Flow (Icef54)
  • Throw ScanException on scan fail and set scanner to setLegacy(false) by default (Ib337c)
  • Throw AdvertiseException on advertise fail (I0e691)
  • Add general bluetooth exception to catch (I0130d)
  • Convert advertise to Flow and change maximum duration (I32fd8)
  • Add serviceData and serviceSolicitationUuids to ScanResult (I6d7f0)
  • Change durationMillis from Long to Duration (I89d49)
  • Add rssi, and periodicAdvertisingInterval to ScanResult (I60b51)
  • Add serviceSolicitationUuid and solicitationUuidMask to ScanFilter (Ic2206)
  • Added GattServerSessionScope#subscribedCharacteristics (I0edab)
  • Add serviceSolicitationUuids to AdvertiseParams (Ic9aa7)
  • Change AdvertiseParams.durationMillis from Int to Long (I6873f)
  • GattServerSessionScope#notify does not return but throws an exception if it fails (Ifc26f)

Bug Fixes

  • Extract scan functionality (I4d43f)

Version 1.0.0-alpha01

September 20, 2023

androidx.bluetooth:bluetooth:1.0.0-alpha01 and androidx.bluetooth:bluetooth-testing:1.0.0-alpha01 are released. Version 1.0.0-alpha01 contains these commits.

New Features

  • This is the initial release of AndroidX Bluetooth APIs that provides a Kotlin API surface covering Bluetooth LE scanning and advertising, and GATT client and server use cases. It provides a minimal API surface, clear thread model with async and sync operations, and ensures all methods be executed and provides the results.