Is it Possible to Continuously Scan for Bluetooth Devices on iOS and Android?

We sometimes get asked if it’s possible to use a smartphone as a gateway to scan for Bluetooth devices. The thinking is usually that workers or users already have devices so why not make use of them?

While it is possible, there are many reasons why you might not want to do this:

  • On iOS, Apple hide Bluetooth MAC addresses and for some APIs hide the iBeacon ids making unique identification more difficult.
  • You will find it very difficult to get a continuously scanning app through Apple app store review. You will need strong justifications.
  • Scanning continuously uses lots of battery power, even when advertising with periodic ‘off’ and ‘on’ periods.
  • Capabilities of devices vary meaning you will almost certainly get some end user devices where your implementation won’t work. For example, some manufacturers stop long running processes.
  • On Android there’s a limit of six scans every 30 seconds. Also, it’s necessary to scan in a foreground activity to prevent the operating system from throttling detections. There are hacks to instead run scanning in threads but these aren’t officially supported and so might not be viable in future OS releases. It’s best not to create production apps based on hacks as they can suddenly stop working.
  • Some users will play with their phones and end up purposely or inadvertently disabling your application.

The best scenarios are those where you can dictate the phone type, it can be mains (PSU) powered and the phone isn’t owned by a user (i.e. it’s just used as a gateway). It’s almost always better to use a dedicated gateway.

What is a Bluetooth WiFi Gateway?

A Bluetooth WiFi gateway is a device that connects Bluetooth devices to a WiFi network. It allows Bluetooth devices, such as sensors, beacons, or other IoT devices, to communicate with a WiFi network and exchange data with other devices on the network or remote servers or the cloud.

Bluetooth WiFi gateways have both Bluetooth and WiFi capabilities and are able to bridge the communication between these two technologies. They are often used in IoT (Internet of Things) applications, where they can be used to connect a variety of Bluetooth devices to a WiFi network, allowing them to communicate with each other and exchange data.

Gateways are configured through web pages hosted within the gateway itself. These configuration pages allow you to set up the WiFi access point that the gateway connects to, the destination server, typically using protocols such as HTTP or MQTT and determine which Bluetooth devices are allowed to be relayed. The gateway setup also includes filtering options to manage the data sources based on the Bluetooth advertising and/or Bluetooth MAC address. Power for the gateways is generally supplied through a USB connection, which is used solely for power delivery and not for data transfer.

There are also gateways that connect via Ethernet rather than via WiFi.

View Gateways

Filtering Beacons at Bluetooth Gateways

When using Bluetooth gateways, it is usual to reduce the number of Bluetooth devices that are sent to the server. This is because gateways do not just pick up the beacons you intend to monitor. They can also detect smartphones, vehicles, fitness trackers and a range of other Bluetooth devices. Although it is possible to ignore unwanted beacons at the server side, filtering them out at the gateway itself is a much more efficient approach. Doing this helps to reduce network bandwidth usage and places less strain on your server, allowing it to provide greater throughput, from multiple gateways, and just handle the meaningful data.

Another key advantage of filtering at the gateway is that it simplifies debugging and ongoing support. When there are fewer devices being reported, there is less data to sift through, making it quicker and easier to identify and solve any issues that may arise.

Most Bluetooth gateways offer the option to configure a whitelist based on advertising patterns. This allows you to instruct the gateway to block other devices before the data ever reaches your server. The challenging part lies in identifying exactly what a beacon is advertising. To tackle this, we recommend scanning for your Bluetooth beacons using a smartphone app that captures the raw advertising packets. Our blog post goes into greater detail about scanning for beacons and explains some of the nuances.

Once you have captured and analysed the advertising data, you can use the findings to set up an appropriate whitelist pattern on your gateway.

New MG4 Rechargeable Gateway

We now have the new MG4 Rechargeable Gateway available. This gateway collects advertising data from iBeacon, Eddystone, Bluetooth LE sensor and other Bluetooth LE devices and then sends it to your server by HTTP(S) or MQTT using WiFi (2.4GHz only).

A unique aspect of this gateway is that it has a rechargeable battery that lasts up to 12 hours so that it can operate during a power outage. The in-built memory stores up to 1080 records avoiding data loss during power and/or network loss.

Development of a Bluetooth LoRa Gateway Using ESP32

There’s new research on the Design and Implementation of a BLE Gateway Using ESP32 chipset (PDF). Bluetooth Low Energy (BLE) and Long Range (LoRa) are commonly used wireless technologies for IoT devices, useful for their low power use and long range respectively. The mixing of BLE and LoRa in a single gateway significantly improves the flexibility of IoT networks, providing efficient data gathering and transmission.

An affordable, flexible gateway was developed, combining the benefits of BLE and LoRa communication and taking advantage of the ESP32 microcontroller’s capabilities. This setup allows for effective data collection from BLE devices and transmits the consolidated data to an MQTT server or a LoRaWAN cloud.

An initial prototype was produced, which led to a customised solution based on a PCB.

Looking to the future, the author says there’s scope to improve the software and firmware further, optimising the algorithms, reducing power usage, and exploring additional features such as multiple communication protocol support or advanced security measures. Such advancements could offer a more adaptable and reliable solution for users’ wireless communication needs.

However, the necessity of refining this solution is questionable as there are existing solutions, such as the LW003-B LoRaWAN Probe, already available, that solve these issues and productise in a case.

Small, Inexpensive Gateway

Every now and then, we come across a product that’s a bit different. In this case it’s a very small and reasonably priced gateway, the MG3.

It is designed to gather advertising data from iBeacon, Eddystone and other devices. It sends this data to your server in JSON format using either HTTP(S) or MQTT protocols. The device connected to a 2.4GHz WiFi. To indicate its status, there is an RGB LED integrated into its design.

While the marketing materials mention detecting Minew beacons, it can detect any kind of beacon and, more generally, any Bluetooth device that is advertising. It has the capability to process data from up to 70 devices per second. Although its optimal range is 70 meters in an open space, this range is dependent on the power of the beacons being detected.

The device conveniently uses a standard USB connection for power. It consumes approximately 340mA of power, which decreases to 290mA if the LEDs are turned off.

To change the device settings you use a smartphone app. Please note that currently, the app is only available for Android devices. The settings you can configure include the method of data upload (HTTP(S) or MQTT), server URL, upload interval, RSSI filter, MAC address filter (using Regular Expression), raw Bluetooth filter (using Regular Expression), and time zone settings.

View all gateways

Beacon Settings for Asset Tracking

Bluetooth beacons are increasingly being used for asset tracking. Their use in this context differs significantly from their conventional role of in-app triggering. In asset tracking, gateways rather than smartphones are used as detection devices, requiring different configurations for optimum efficiency.

iGS03E Bluetooth to Ethernet gateway

Changing Bluetooth beacon settings requires the manufacturer’s specific application custom-tailored for their devices. These apps adjust the beacon parameters according to specific needs.

A most important setting when using beacons for asset tracking involves is the advertising period. This is the time interval between the broadcasted signals. In the the app detection usecase, a frequent advertising period is required to ensure constant detection by nearby smartphones and particularly for iOS. However, in asset tracking, the scenario is different.

Since gateways, not smartphones, are used for detection, a lower advertising period, ranging from 1 to 10 seconds, is sufficient. Less frequent advertising has the advantage of conserving the beacon’s battery life. It also ensures the server isn’t flooded with duplicate data.

The beacon’s advertising type is another key consideration. iBeacon or Eddystone UIDs are usually used for detection by smartphones due to their compatibility and detection by mobile operating systems. However, when using gateways and servers, the Bluetooth MAC address of the beacon is usually used for identification. Consequently, any advertising type can be selected, eliminating the need for specific compatibility.

Where multiple advertising types are available, it’s essential to ensure that only one advertising type is selected. Even though gateways can utilise any advertising type, using multiple types simultaneously can lead to increased energy consumption by the beacon and more redundant data at the server.

New Minew MG3

The MG3 is a new mini USB Bluetooth-WiFi gateway.


It’s a more affordable version of the G1 with slightly less capability:

The MG3 collects advertising data from all Bluetooth LE devices and then sends JSON data to your server by HTTP(S) or MQTT using WiFi.

The MG3 processes up to 70 Bluetooth devices per second. The maximum range is 70 meters in open space but this depends more on the range of beacons being detected.

Configurable data collection settings include the upload method (HTTP(S) or MQTT), server URL, upload interval, RSSI filter, MAC address filter (RegEx), raw Bluetooth filter (RegEx) and the time zone.

View All Gateways

Reducing Bluetooth WiFi Gateway Connections

When a Bluetooth WiFi Gateway sends data to a server via HTTP, the gateway has to connect to the server to start a connection and then use that connection to send the data. The connection part starts a new TCP connection with handshaking. Starting a new connection every time data needs to be sent to the server uses network data and creates work for the server.

iGS01S

Some gateways such as the IGS01s have a ‘keep-alive’ setting that allows the connection to be re-used across HTTP requests. This reduces the amount of data used on metered networks such as cellular, reduces possibly metered data throughput at the server and also reduces server loading thus improving performance.

Having said all this, you should consider MQTT if you are really concerned about efficiency and performance.

View All Gateways

INGICS iGS03W in Stock

We have limited quantities of the new INGICS iGS03W Bluetooth WiFi gateway in stock.

The iGS03W listens for beacons, gets their advertising data and forwards it on to your server or an IoT server via TCP, HTTP(S) or MQTT including AWS IoT, Google Cloud IoT and Azure IoT Hub.

It differs from the iGS01S in that it supports greater throughput, Bluetooth 5 Long Range mode (LE Coded PHY) and also includes a wall holder.

View all Bluetooth gateways