A DIL (Disconnected Intermittent Low bandwidth) environment presents many problems. Sharing data between users is a significant issue. Most applications rely on a robust and constant connection to a network in order to collect and distribute data between users. But what happens when there is no network connection and it is critical for close proximity users to exchange data? What if they need to transfer data across mobile devices with different operating systems? There are a few possible solutions that can be developed to solve this problem using libraries available in the Xamarin stack.
Standard Options for Peer to Peer Data Sharing
Many mobile devices are able to send and receive data via bluetooth. It is possible to create a connection between devices on this bandwidth and transfer data. Bluetooth can work in many situations, but if the user is in an area with high interference in this frequency range, or if security is an issue and she/he does not want their signal discovered, bluetooth is not an option. Near-Field Communication (NFC) is another technology that can be leveraged to create a connection between devices. NFC data transfer is secure due to its extremely close signal range (approximately 10cm). Unfortunately at the time of this writing it is not available as a solution on iOS devices. Apple’s Core NFC API has provided developers access only to the read functionality of the NFC chip in their devices. Another issue with NFC is that due to its low signal strength it is susceptible to interference. If bluetooth and NFC do not work for your use-case, what other options are available?
Optical Peer-to-Peer Data Transfer
Another option to consider for peer to peer data transfer is optical. Data can be encoded into QR images and those images can be displayed on a device’s screen. A second device can simply use it’s camera to read the image and then it can decode the QR image back into data. There are limitations to the amount of data that can be transmitted in a single image. When encoding numeric data (0-9), up to 7089 characters can be stored in a single image. When using a limited alphanumeric (0-9A-Z $%*+-./:) 45 character set, up to 4296 characters can be encoded in a single image. You can also use an ISO 8859-1 character set to encode up to 2953 characters in a single image. If the amount of data you are attempting to transmit is greater than the capacity of a single image, one can implement custom solutions to break up the data into multiple images. The images can be read and the data recombined on the receiving device. This would also require custom implementation. Custom solutions that are developed to handle these data issues can be leveraged in both major mobile platforms if it is developed using Xamarin.
Optical Peer-to-Peer Data Transfer has some advantages when compared to other peer-to-peer data transfer methods. It is secure because intercepting the transmission requires a clear line of site to the image. The data can also be encrypted prior to generating the encoded image, ensuring that the underlying data cannot be read without the encryption key. When using this method of data transfer, there is no chance for interference to disrupt the communication. The images can be read in daylight or dark because of the back-lit screen on mobile devices. Additionally, there are no concerns about electromagnetic interference. Another benefit to this method of data transfer is that the transmission can be communicated across different mobile platforms. The QR Code is platform agnostic, so an Android device can transfer data to an iOS device and vice versa by using the Optical Peer-to-Peer Transfer method.
Optical Peer-to-Peer Data Transfer is a novel solution for data transmission across mobile devices in a DIL environment. NFC may not be 100% reliable in all conditions, and currently peer-to-peer sharing using NFC is not an option on iOS. Bluetooth transmission may not always be an option if the use-case requires that the user not be discoverable or there are other security concerns. Directly transmitting data that is encoded into QR codes from one device’s screen to another mobile device through the device’s onboard camera is a simple and elegant solution to peer-to-peer data sharing when other methods fall short. The Xamarin development platform is the most efficient way to create and deploy a cross-platform mobile app with this data transfer functionality.