Necessity is the Mother of Invention
In 1994, Bluetooth was invented at the headquarters of ericsson in sweden as short-link radio technology in search of a way to develop and connect headphones wirelessly to computers.
Now it is managed and developed by Bluetooth Special Interest Group or SIG for short. SIG is a not-for-profit organisation that was formed in 1998 to oversee the development and licensing of Bluetooth technologies. For a device to be known as a Bluetooth device it has to meet the standards set by SIG and must acquire licenses to a network of patents that apply to the technology. This is where cross platform file sharing using BLE (Bluetooth low Energy) gets a little complicated.
Almost everyone who uses a Bluetooth device must have had ‘one’ common question:
Why is Bluetooth called what it is called?
No, it does not have anything to with a blue coloured tooth but with a medieval king of Denmark named Harald Bluetooth.
Jim Kardach, the person who proposed this name was reading a book named ‘The Long Ships’ about King Harald and suggested that Bluetooth does the same with communications protocols as King Harald did with various Danish tribes: to unite them into one universal standard.
Since then, Bluetooth has had three successful versions until now that were being widely used in mobile devices. They were versions 3.0, 4.0 and the recently launched Bluetooth 5.
20 years later, we were again searching for something proprietary, in need to connect Internet of things (IoT) in an energy efficient way and we developed Bluetooth Low Energy (BLE).
First off, let’s distinguish ‘Classic’ Bluetooth from BLE or Smart Bluetooth.Although they share the same name, they are entirely different technologies.
Where ‘Classic’ Bluetooth consumes more power, transmits over longer distances and can transfer more data, BLE only transmits Bluetooth Low Energy signals with very less amount of data that can be picked up by any other BLE device in the vicinity.
Where ‘Classic’ Bluetooth is better used to transfer large amounts of data or stream music over a Bluetooth speaker or headset, BLE is more likely to be used in instances when one device is a small object like a beacon used to provide proximity in a store or a heart rate sensor to send data to a mobile device.
In the BLE there are two roles that the devices play. The roles are called that of the Central and of the Peripheral. These roles are used to establish a link between two different devices where a peripheral can advertise, to let other devices know that it’s there, but it is only a Central device that can actually send a connection request to establish a connection.
BLE devices can also operate without the two devices ever entering a connection, and that is with the roles of an Observer and a Broadcaster. The Observer here would just listen or scan packages while the Broadcaster would send such packages.
BLE is now being used mostly to connect mobile devices to the outer world without having to connect any wires to different devices. BLE is the exact thing that was required to make our mobile phones the devices that could control and monitor all the other devices that have become an essential part of our modern lives.
Now that we know a little of what BLE is and how it works let’s talk about transferring data across platforms.
We recently got a very exciting opportunity to work upon a mobile app that would enable its users to connect and share their business cards across platforms.
So here is our hands-on experience from building a firsts of its kind app.
With cross platform here we meant to transfer data from iOS to Android and back from Android to iOS. For this, most of us would know that ‘Classic’ Bluetooth can’t be used as Apple has added a limitation to their devices to not receive or send data using ‘Classic’ Bluetooth unless both the devices have enrolled for MFI (Made For iPhone).Since no android device has ever registered with MFI, transferring data from android to iOS and back becomes impossible using ‘Classic’ Bluetooth.
But then, both android and iOS have classes for BLE that allow them to become both Central and Peripheral at the same time. This means that if the amount of data that is to be transferred is of small quantity, we can try to send it using BLE. Even if the data is not small, we can break it up into smaller chunks and then send it using BLE and we’ll have ourselves a method that allows us to transfer data across platforms without having any web server in between and without having to create local wifi networks.
We decided to try our hand on getting data transfer across platforms using BLE and given below is our approach:
To do it, we decided on two different methods which can be found below. Also, we are not just sending small amounts of data here (like BLE was supposed to do), but dividing large amounts of data in different chunks and then sending those chunks in the same order and reforming the initially sent data at the receiving end.
Method 1: To broadcast data as it is, along with an ID that could be scanned for, and every available device scanning for that ID would be able to receive the said data. This method would not require for us to establish a connection to the other device.
Method 2: To broadcast the device name with services and characteristics with data such that the scanner would be able to first show a list of all devices and then the data from the selected device would then appear in the receiver. Thus, a connection would first be established and only then the data would be transferred among the two connected devices.
But all is not a piece of cake, below are the shortcomings of each method:
a. Every application searching for that specific ID would be able to get the data being sent, which makes the application much less secure.
b. iPhones were unable to scan the data using this method in about 95% of the times.
a. The advertisement made by Android devices in this case could not be connected to by an iPhone.
Below are the scenarios that we came across when testing all four of our applications.
a. Android to Android: This method worked in most of the android devices, the breakup has been given below in tabular format:
b. iPhone to iPhone: iPhones were unable to receive any data using this method most of the time.Thus, out of the 4 android devices used, all were successfully able to broadcast the data using Method 1 but only two devices were able to successfully receive the data.
c. Android to iPhone: iPhones were unable to receive any data using this method most of the time.
d. iPhone to Android: Only the two devices that were able to receive the data in part a. above were able to receive the data from iPhones as well.
a. Android to Android: It was great trouble when trying to connect to an android Peripheral, but once connected, data was being transferred with relative ease.
b. iPhone to iPhone: This method worked flawlessly for the three iOS devices used:
c. iPhone to Android: Using this method all the android devices (put under testing) were able to receive the data from iPhones
d. Android to iPhone: iPhones were not able to connect to the android device using this method.
Wrapping up our experience:
Method 1 is unsecure since any application that knows the UUID, that we are broadcasting the data at, would be able to receive every data that is being transferred as long it is still close by. Even if this method was secure, we ran into issues on the receiver end where the receivers were not able to receive the data at most times.
Method 2 is much more secure as the two devices create a connection first and then only do they start to transfer the data. The problem with this method is that when creating an Advertisement from Android and then connecting to this advertised device, we ran into some trouble. After much trial, we were able to connect to the Android Peripheral using Android Client but were not able to connect to an Android Peripheral using iPhone client, which defeated the whole purpose of our research.
Thus, method 1 can be used to transfer data among android devices, while method 2 can used to transfer data among iOS devices. In addition, we can use method 2 for flawless data transfer from iPhone to Android, but we couldn’t find any reliable way to transfer data from Android to iPhone using BLE.