Building BLE based Mobile app- A Real-world Xamarin use case
Published on 5 Nov 2018 | Virendra Thakur
Why our client wanted a Xamarin-based BLE enabled Mobile App?
Our client is a Canada-based technology company, which is dedicated to making the world a safer place. The team is made up of highly-innovative individuals with the vision to promote safety, awareness, healing, and prevention through the power of a community. With the strong vision to help the citizens of Canada and make this world a better place to live, the company’s mobile app ideation triggered way back in 2015. The client needed an User Safety mobile application that works as a monitoring service, which would allow people to track the location and safety status of their loved ones. If the loved one needs assistance in emergency or bad situations, he/she can trigger an alert, where guardians would be notified via email, SMS, and app.
Adding to this, the client wanted to use BLE devices to ensure security in various conations, for the scenario when ARI’s (At Risk Individual) phone is unavailable (lost/broken). Using BLE device, as an accessory on an individual’s body, would help ARI to operate the mobile. This is an important way for a user to trigger an alarm in emergency. However, it is only significant if it works flawlessly and broadcasts messages & location details to their loved ones or nearby people.
What is BLE?
Bluetooth Low Energy (Bluetooth LE, colloquially BLE, formerly marketed as Bluetooth Smart) is a wireless personal area network technology designed by the Bluetooth Special Interest Group (Bluetooth SIG) in 2011. It is being utilized in numerous applications in various domains such as,
- Personal Security
- Healthcare and Fitness
- Blood pressure monitors
- Fitbit-like devices
- Industrial monitoring sensors
- Geography-based, targeted promotions (iBeacon)
- Entertainment industry
- Public transportation apps etc.
Compared to Classic Bluetooth, Bluetooth Low Energy (BLE) consumes less power and provide seamless connectivity. Mobile operating systems including Android, iOS as well as macOS, Linux, Windows 8 & 10 support Bluetooth Low Energy.
BLE – What is its role in IoT?
Energy efficiency of BLE has made it one of the most compatible options for IoT and a preferred one. BLE consumes less energy than ZigBee, Bluetooth classic and Wi-Fi, so it supports better connectivity of IoT device for longer period. Also, BLE’s low data rate makes it extremely suitable for utilization in cases where we need to exchange data with sensors.
The Approach and Implementation
Our Xamarin development team's expertise in building best-in-class mobile apps helped build this engaging, high-performance mobile app for our client. helped Saviant team to build this engaging, high-performance mobile app for our client. Leveraging Xamarin framework helped in overcoming the development challenges to include path-breaking app features; which included activating alerts at emergency or uncomfortable situations, adding guardians, notifications, Bluetooth settings, recording audio & video, and many other unique features.
One of the main challenges was to integrate the BLE device functionality with this community-based safety Xamarin mobile app. To begin with the Xamarin implementation, firstly our consultants needed to understand the scenario of emergency where the mobile is unavailable/lost/stolen. In this case, the Xamarin app would get started once the victim double taps the BLE device. It would send notifications/alerts and GPS location to the guardians for the immediate help. To identify the BLE device, our team enabled the Xamarin framework to call native platform specific BLE frameworks (Xamarin Android and Xamarin iOS), which will find the BLE device by using mobile phone’s Bluetooth. And, to identify the BLE device, we enabled the native BLE framework to scan all the BLE devices which come under the mobile device’s Bluetooth range (30m approx.). If the device found within the range then the Xamarin native BLE framework will attempt to connect BLE device by using BLE device’s name or its associated UUID (unique identifier for each BLE device), and the Xamarin framework will attempt connection with BLE device based on the device’s UUID.
Xamarin native BLE framework performs the following operations:
- Scan for BLE devices.
- Identify the device Name or UUID and attempt to connect it.
- On successful connection, it will discover for service and characteristics.
- Write the characteristics to device and register for the various services and events.
Our Xamarin developers dedicated efforts resulted in many client benefits including:
- Rapid creation of robust BLE based device functionality that enables the user to notify location information to dear ones / near-by people.
- Quick and painless integration of secure BLE device functionality with the community-based User Safety Xamarin app.
- Helped in making the app users’ life easy as BLE devices save users from bad or emergency, which is the major goal /use case of user safety application.
- Faster go-to-market with the Xamarin solution for iOS & Android.
- Better market access with path-breaking features that can help individuals to protect their family & friends from unsafe situations.
- Quickly able to integrate BLE based devices, one of the emerging technology nowadays, and provided seamless connectivity between BLE device & Xamarin based mobile apps.