Skip to content

Bluetooth Low Energy

Peter Foot edited this page Mar 10, 2022 · 13 revisions

Introduction

Low Energy uses the Generic Attribute Profile to support a hierarchy of Read/Write/Notify operations on a set of Characteristics rather than using a constantly open stream like classic Rfcomm connections.

Platforms

Bluetooth Low Energy is supported on Windows 8.1 and later, iOS, macOS, tvOS, Android, Tizen and other platforms. Capabilities vary depending on OS and version. 32feet has a pre-release library for Bluetooth LE - InTheHand.BluetoothLE.

Android

Add <uses-permission android:name="android.permission.BLUETOOTH" /> to your AndroidManifest. If you want to allow discovery in the app use

    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

too. You'll need to request location permission from the user via:-

    RequestPermissions(new string[] { Manifest.Permission.AccessCoarseLocation, Manifest.Permission.BluetoothAdmin }, 1);       

If your app requires Fine Location too, just request one of these permissions, Bluetooth will work with either but Coarse Location is the minimum required.

iOS

You must add a display prompt for "NSBluetoothPeripheralUsageDescription" to your info.plist. On the latest iOS versions also use "NSBluetoothAlwaysUsageDescription" to use Bluetooth LE for foreground or background use.

Windows

The current version of Windows 10 is the Creators Update and this supports Bluetooth LE with support for acting as a GATT Server, and discovering and interacting with unpaired devices. You must declare the "bluetooth" capability to use any Bluetooth LE functionality in your application.

Clone this wiki locally