-
Making of our Android app
08/24/2018 at 21:07 • 1 commentHello everybody. My name is Vojtech and together with Tomas we are developing our Ariadne Headband. Our project should serve as a novel approach for navigating people that are in bad conditions. Our Headband uses 4 vibration motors that use haptic feedback to navigate you.
When you use such a device, you want to choose where you want to go. This is the task of our mobile app. This log should document journey as a novice into mobile development with Ariadne Headband Control app. This app, together with other parts of our projects, is open-sourced on GitLab so you can download it and build it for your own needs.
What do we need
Ariadne Headband Control app depends on two important parts: maps and Bluetooth. We need maps so the users of our application can select their destination. While there are open-source options as a OpenStreetMap, they were not suitable for us. We selected Google’s SDKs because it supports both Maps and Location search (you can for example find shop location, not just the address). These SDKs also have good free usage quota and can be freely used to Android apps.
The second important part is Bluetooth. We need Bluetooth in order to communicate with the Headband so we can control it. Currently, we have HC-06 Bluetooth module because it was available in our country and we needed to start fast (we started working on this project 1 month before deadline). HC-06 is Bluetooth classic module which means that is older version of Bluetooth protocol. It consumes more power and is more suitable for heavy data stream usages (as is streaming of audio). However, newer versions of protocol, Bluetooth Low Energy, would be better for our usage. We plan to switch in near future.
Choosing the right toolkit
We wanted to choose the best method possible for making of our app. Currently, there are two possibilities. We could either use Java and make native Android app that could run easily on my phone. This way we can access both Google SDKs and Bluetooth Classic. Second option is multi-platform development, most notably React Native and more recent Flutter. Advantage of this approach is that the same run could possibly run on both Android and iOS devices. The problem is that (in my opinion) React Native targets iOS better and Android performance is not that good. Flutter seemed very nice, developing apps was extremely straightforward and fast. Sadly, Flutter currently has poor support for Maps and does not have any library for Bluetooth Classic.
The only possibility left was making a native Android app using Java. This was little bit scare business because we would not know if we can finish the app before the deadline. Jumping right into learning by doing was to best possible move. We finished the app in slightly over one week of hard work. And actually, Java seems pretty cool.
The beta version
Our app is developed as open-source project and is available on this gitlab repo. We did not published it yet on Google Play so if you want to run it yourself, you will need to build it from source with Android Studio. As we mentioned in repo’s README, you will need your own Google API key to successfully build and run the app.
On the image above you can see screenshots from our app. It may not be the prettiest thing but it works well for beta version. When you open the app, you see landing page (Screenshot #1) where you can connect to Bluetooth device, open settings, select destination and start navigation. When you click on Select destination, you will see a page with Google Maps. The app will try to get your current GPS location. (Right now, GPS will be used only when you are on this page. In future releases, GPS will be used also in background so you can find your location in less time.) Thanks to Google Place Autocomplete SDK you can click on Search button to find the exact location of almost everything, e. g. shop or street. Results are set only for your country.
For the Bluetooth part, we had to make some compromises. Working with Bluetooth using default library is not very intuitive, at least for Android programming beginner and I was not able to make it work in such short time. For that reasons we decided to use open-source BluetoothSPP library for Android. This awesome library allowed us to work with our HC-06 module almost instantly and saved us lots of time to put into different problem.
Future improvements
Current app serves mainly for testing purposes and while it can be to some extent be used by everyday user, it needs lot more work to make it enjoyable. When we don’t count bugfixes, useful improvements could be using Services for GPS tracking (so the app can get your location updates regularly and adjust itself) and list of favorite places (aka bookmarks).
One of the notably more complicated features would be real time navigation. With this activated, vibration motors would navigate you when you would arrive on crossroads and show you the right path. Also, we see a bit potential in smart watches that run Android. You could possibly control the Headband simply using voice commands. Unfortunately, we do not know anyone who own Android Wear smartwatches so we cannot try this right now.