Providing External Signals for Bluetooth and WiFi Scans on Android Devices
By: Elvina Sh
Tags: Technology, Innovation, AndroidDev, Android, Programming

Providing External Signals for Bluetooth and WiFi Scans on Android Devices

How we adapted to work with indoor navigation in quarantine

Image from Dribbble by Folio Illustration Agency

Hi there! I am from the Navigine team. For eight years we have been providing integrated positioning mobile technologies that enable advanced indoor navigation and proximity solutions. Today we want to tell you about workarounds we had to come up with to improve testing of the indoor navigation without having beacons and other devices that emit the signals we need. Let’s dive into and find out how you can use it.

A necessity in public functions

Quarantine continues in all parts of the world, but this does not stop us from continuing to work and find better solutions for indoor navigation and improve existing ones. Due to the fact that we continue our work remotely, we need to test our solutions for correct operation, but sometimes the absence of beacons or other devices emitting signals forced us to come up with a trickier solution. So we decided to make public methods for providing WiFi and Bluetooth signals. These solution can be useful not only for indoor navigation, but also in other cases if your technology uses bluetooth or wifi devices.

It is also worth paying special attention that this method can also be used in other cases, for example, if one of Bluetooth or WiFi sensors does not work well on your device, or if you decide to test someone else’s solution, but don’t want to buy beacones. Of course, you can still use some application that emulates these signals, but this solution does not always work well, because sometimes you need a beacon of a certain type, and most applications allow you to change a very limited number of parameters.

Description of function parameters

When you use Bluetooth or WiFi scan, you receive signals in the scan callback and then pass the data to your function, in which a certain magic happens. But in the absence of devices emitting signals, there will be no magic, so for further testing you will have to use a similar solution when you immediately supply data to your magic function. In our case, this magic function will evaluate your indoor position. So let’s try to understand the variables we use to pass to the function.

iBeacon AD structure

For Bluetooth measurement data providing function Name is Bluetooth device name and address is its mac address. These fields for beacons are not so important, so we will not focus on them. Rssi is a measurement of the power present in a received signal. ScanRecord is a byte array which consists parameters like major, minor, uuid, power, etc. You can find more information about this byte array data in documentations of each beacon manufacturer.

For Wifi measurement data providing function there is only one parameter. ScanResults are vector of scan results, where each scan result contains information about BSSID, SSID, level, frequency, etc. For getting more information we recommend you to read the ScanResult docs.

How to use

After having all these data you can provide custom signals to your function without scanning any Bluetooth and WiFi devices. And most importantly, it’s worth calling these functions with a certain frequency in order to receive data constantly and the function you need is constantly being performed, in our case it’s a navigation evaluating. So here is the code snippet, how you could run indoor navigation and provide Beacon info to it.

By the way, you will need to create your own functions for generating Beacons and WiFi signals for providing to this functions, but this is another task and could be told in another article.

Conclusion

Of course, it is best to use real devices that emit signals and test the navigation in your location on real data. But sometimes there is a need to resort to such workarounds. This solution is quite well suited as a temporary solution for testing navigation at your location or testing other points that are interesting to you or if you do not want to purchase additional materials for this, without making sure that this is what you need.

You can find more details of this solution in case of our SDK in our wiki. Also you can find Demo application in our GitHub. Feel free to ask your questions and leave your feedback.