Bluetooth (Beta)
BLE support is currently in Beta. Some functionality is not available yet, and it may require further stability updates.
BLE support is currently only available for customers on the Enterprise plan.
Compatibility Requirements
A custom-branded container is necessary for Android, iOS and Windows for any Bluetooth
functions. Please contact JourneyApps Support to request one.
TypeScript is recommended
The Bluetooth
functions in JourneyApps rely on async-await. While it may be possible to work around this in a JavaScript app with promises, we strongly recommend using TypeScript.
JourneyApps' Bluetooth Low Energy (BLE) support allows users to scan for and connect to nearby BLE devices in real-time. The simplest way to achieve this is using Bluetooth.requestDevice()
. For more advanced use cases, Bluetooth.requestLEScan()
is available. More information on both these methods can be found below.
Bluetooth.requestDevice()
Bluetooth.requestDevice()
requests a device according to filters.
On Web, a list of devices is returned to the user, from which the user can proceed to select one.
On Windows, Android and iOS, Bluetooth.requestDevice()
the first matching device is automatically selected. We recommend using Bluetooth.requestLEScan()
(see below) on these platforms should the user need to select a device.
Usage example
Bluetooth.requestLEScan()
Compatibility requirements
Bluetooth.requestLEScan()
was introduced in version 4.84.0 of the JourneyApps Runtime. It is supported on Windows, Android and iOS only.
Bluetooth.requestLEScan()
should be used (instead of Bluetooth.requestDevice()
) where the app needs more control over the BLE scanning process. It is based on this spec. Note the following differences from this spec:
Added the
signal
parameter to cancel scanning.Events do not include
manufacturerData
,serviceData
,txPower
orappearance
.
Ensure that your TypeScript app has the following version in package.json
: "@journeyapps/runtime-build": "^2.0.2"
. Note that after updating package.json
, you need to run Update yarn.
Usage example
Note that in this example the first device is being connected to. In a real app, you'd typically add these devices to a list (for example, you'd create LocalDB objects and display these in a suitable UI component) for the user to select one.
Last updated