Bluetooth is a widely used, short range (~10 meters), wireless technology.
There are two completely different Bluetooth protocols: Classic Bluetooth and Bluetooth Low Energy (BLE).
Almost all devices support classic Bluetooth and almost all newer devices support BLE.
Bluetooth supports all kinds of “profiles”. Most of the profiles, such as audio, headset, hands-free and many others are managed by the operating system.
From a developer point of view, with classic Bluetooth we can only program the Serial Port Profile (SPP). It implements the RFCOMM protocol and we can use it to create a network connection between two devices.
This is done in B4A with the Serial library and in B4J with jSerial or jBluetooth libraries. iOS doesn’t expose this feature to developers with some exceptions (MFi certified hardware).
Note that you can only connect to a device that is listening to incoming SPP connections.
The BLE protocol is completely different. There are two types of devices: central and peripheral.
The peripheral device advertises information. For example beacons advertise their unique keys.
Central
devices scan for such advertisements. If the peripheral device allows
connections then the central can also connect to the peripheral.
In most cases the Android or iOS device will act as the central device.
The peripheral device stores the information in a set of services. Each service has a set of characteristics. The central can read data, write data and subscribe to notifications.
B4i central and peripheral features are implemented in iBLE library: https://www.b4x.com/android/forum/threads/ble-bluetooth-low-energy-library.46099/
B4A central is implemented in BLE2 library: https://www.b4x.com/android/forum/threads/ble-2-bluetooth-low-energy.59937/ and peripheral mode is implemented in BLEPeripheral: https://www.b4x.com/android/forum/threads/ble-peripheral.84051/#content
Note that the peripheral library is built for a specific use case.
B4R also supports BLE with HM-10 module: https://www.b4x.com/android/forum/threads/connecting-to-arduino-with-ble-bluetooth-low-energy.65824/#content
and ESP32: https://www.b4x.com/android/forum/threads/resp32simpleble-esp32-ble.93287/#content