Developing a BLE application requires a lot of domain specific knowledge. You need to learn a lot of languages that target specific platforms. Eg. Java or Kotlin for Android Native Application development, or Objective C or Swift for IOS development. Moreover, you need to be proficient in the tools, like xcode or android studio. For a hardware developer or a firmware engineer working on the BLE stack, it is very difficult to showcase a working demo on its own, as developing app takes a lot time.

In this blog post we will cover some of the possible ways through which you can get a hold on BLE app development using simpler frameworks. We will discuss about:

  • Ionic Framework
  • App Inventor

To test this app, you will need a BLE device, like the Electronut Labs hackaBLE.

Ionic Framework (with BLE Plugin)

With growing pace of technology, Hybrid application development is taking over, and is making it easy to build apps using the languages you know- like Javascript and Typescript. Along with cordova (which allows us to access native device APIs using reusable code across platforms), you can create an app in a very short time. In this section, we will discuss about the basics of this framework, and guide you through setup and creating a basic app.

Ionic comes with a good UI, and provides a lot of components to start with. Also, It provides APIs to trigger some basic functionalities like creating Alerts, showing Toasts etc. Then comes Ionic Native, which provides a whole lot of native application features including BLE, Wifi, Camera, and Vibration.

Developing Mobile Apps for BLE devices 1 * image source : https://ionicframework.com/docs/components/ *

Setup

  • You need to have NodeJS environment setup on your system, (install ionic globally using npm install -g ionic)
  • Start building an app using ionic start myapp blank.
  • Setup plugin using ionic cordova plugin add cordova-plugin-ble-central and npm install --save @ionic-native/ble

Building

  • Just import the module to your home page. Code should look like :

* You can create a new page using ionic generate page details. Then your details page should look like this to get characteristic and service list.

* Once connected to the device, you can read, write or listen to notification data. Use the following :

  • Write value to a characteristic :
this.ble.read(PERIPHERAL_ID, SERVICE, CHARACTERISTIC).then((buffer)=>{ 
    

}) 
  • Read value from a characteristic
this.ble.read(PERIPHERAL_ID, SERVICE, CHARACTERISTIC).then((buffer)=>{

}) 
  • Listen to Notification data
this.ble.notify(PERIPHERAL_ID, SERVICE, CHARACTERISTIC).then((buffer)=>{ })

Example to above mentioned plugin can be seen Here

There are a lot of cool things you can do with similar plugins on ionic. And the community has posted a lot of examples too. So go explore the ionic community and start building apps.

App Inventor (Android Only)

Someone who is reluctant to write even code can still write a mobile app using this amazing tool by MIT, which uses code blocks, similar to Scratch. You can simply drag and drop the code blocks from the panel and make your app work the way you want. Though the app UI will not be as slick as ionic, it can still get your job done.

BLE connection on app inventor

App Inventor has got a BluetoothLE extension which can be used to list Bluetooth Low energy devices, connect to them, and read and write characteristic values.

Though App Inventor can’t provide an amazing UI, you can still make a quick demo app to showcase your Low energy hardware easily, without writing code. The interface is simple and easy to use.

Conclusion

For development of apps, there are a lot of frameworks available, but mastering them takes time. They are also platform specific, and expensive. Using hybrid app development, like ionic framework and App Inventor, you can quickly develop a demo-ready, data-centric app to showcase your device.