The Power of IoT Connectivity: Building a Lifesaving Breathalyzer Solution with Real Time Results
In just 8 months, we built an intuitive IoT-powered iOS app for a suite of smart devices aimed at improving personal health.
BACtrack
For over 20 years, BACtrack has created accurate breathalyzers for consumers, businesses, schools, clinics, hospitals, the military, and law enforcement.
IoT Solutions
Mobile App Development, Product Design
Project Timeline
8 months
Tech Stack
Swift, Ruby on Rails, Bluetooth
Very has helped us accomplish our goals, doing it on time and on budget. The new app has enhanced our product offering at national retailers and solidified our position as the market leader.”
Keith Nothacker,
CEO BACtrack
The Challenge
BACtrack created the first smart breathalyzer — a literal lifesaver — and bundled it with a free MVP app. The app functioned on a basic level, but after suffering a few global outages, it was clear it needed an overhaul.
To meet user expectations and gain a more competitive foothold, BACtrack needed a new,
feature-rich mobile app that was as consistent, reliable, and as technologically-advanced as
its trusted breathalyzer devices. Additionally, the company realized it could meet business
goals with the development of a subscription-based revenue stream — which would also
depend on a new, robust app.
Ultimately, the app would have to work for four types of users:
- Self-monitored testers: Can take tests and set their own testing schedule
- Tester: Can take tests but can’t change their testing schedule
- Monitor: Can see the tester’s test results, update the testing schedule, and request a test
- Accountability partner: Can only view test results
The app needed to provide robust functionality, including visual verification of the
breathalyzer test; confirmation of test time, date and location; real-time delivery of results;
and smartphone notifications for monitors. With access to real-time breathalyzer results
right on their phone screen, monitors could have peace of mind knowing that testers were
sober and safe.
The BACtrack team knew it could depend on Very to create a new app for both iOS and
Android users. Leveraging our knack for rapid testing and the Agile methodology, we got
to work.
The Process
Design
Our work began with the iOS app.
The BACtrack team gave us access to user-tested wireframes, providing critical insight into
user needs and expectations. Armed with this information, we were able to build out the rest
of the user journey using the wireframes as our foundation.
From there, we worked closely with BACtrack’s product team to solidify the app’s high fidelity look and feel. Because the app’s primary focus was the data itself, we needed to create a user experience that made generating and viewing that data as easy as possible. This presented us with a healthy challenge, especially as we began on the calendar component, which we designed to communicate three separate but related data sets: the user’s testing schedule, results, and missed tests.
Development
Once we finalized the app design, our team moved onto the development phase.
We built the new version of the app on Native iOS with a Rails API. Using native Swift
enabled us to build rich user interfaces while ensuring a consistent Bluetooth connection in
the background. We also opted to work with Ruby on Rails, which allowed us to move rapidly
on the back end development. We also leveraged open source libraries and common
development patterns, including:
- Authentication: Gems to have different types of user roles
- Workflows: The Interactor Gem to facilitate rich workflows
- Administrative Interfaces: Active Admin
- Scheduling: The Sidekiq Gem, an existing scheduling library
As we do in all of our projects, we followed an agile development process to allow for incremental development, launching iteratively in releases, providing working software with each release.
Building Robust Features Without Compromising Agility
A core feature is the ability to record visual evidence of users taking a test. But videos and
images are notoriously heavy to store and upload, so we implemented a system that
automatically deletes them as soon as they’re uploaded to the app server. This keeps the
user’s device clear of unnecessary files.
Building for Stability and Reliability
On top of adding streamlined functionality, the Very team built a more robust and stable
system to improve reliability. We used monitoring tools like sentry.io and Klaviyo to investigate
and identify the most impactful errors experienced by the users and address them
accordingly.
The team included a dedicated quality assurance engineer who prepared a set of automated
tests and manual tests for every new release. Testing was conducted in a closed
environment that replicated our production system. This methodology enabled us to test the
app without affecting the versions currently in use.
We also implemented these suites of automated tests in our continuous integration
system, enabling us to detect bugs before they could reach end users. Additionally, we
upgraded the app’s database and server to newer versions to mitigate deprecated
features and security risks.
As always, we followed an Agile development process to allow for incremental
development, launching iteratively and providing working software with each release.
Implementing Intuitive Bluetooth Connectivity
BACtrack’s app needed Bluetooth connectivity to communicate with the breathalyzers. It was up to
us to determine how to establish that connection, all while incorporating a countdown timer to
prepare the device for a test, receiving the blow, and collecting the results.
Every Bluetooth-enabled device provides an API, which is a list of actions that apps can use when
they’re connected. However, implementing these actions in the app’s code is challenging and
must be done carefully to avoid crashes or issues. These actions include obtaining device
metadata, like serial number and device type, starting a countdown for the device to prepare
for a test, opening the device to receive data while the user takes the test, and listening to the
device to provide BAC results.
The Bluetooth also needed to detect when the device was on or off, all while ensuring that the
phone’s memory was not drained. If the device is turned off while the user is on the testing screen,
the app will detect this scenario. After attempting to connect for some time, the app will display an
error message requesting the user to turn on the device before proceeding with the test.
Expanding to an Android App
Using the iOS app as a blueprint, we moved onto the Android version of the app. From a
functionality standpoint, the apps were created nearly identically, and because we’d already
fleshed out the design in the iOS version, we could skip straight to development.
Android apps are written in Kotlin, which means our development process looked somewhat
different than it did during the iOS project, specifically regarding Bluetooth functionality. Both the iOS and Android apps used a native SDK provided by BACtrack to communicate with the breathalyzer. This means that each app had its own implementation with OSspecific requirements.
Developing the new Android app presented a unique challenge because it incorporated the latest Android technologies. (The SDK is slightly outdated in comparison.) As a result, we undertook necessary upgrades to ensure seamless compatibility. Still, we were able to maintain consistent communication and deliver an unaltered user experience.
We were able to maintain consistent communication and deliver an unaltered user experience.
We incorporated a range of enhancements to elevate the user journey in the Android app version. Notably, we introduced robust error handling mechanisms to address situations such as internet unavailability or potential breathalyzer errors, which can occur when breath data isn’t captured or when a user ceases blowing. Furthermore, we implemented a resilient retry system that empowers users to successfully upload their test videos even if interruptions occur due to poor connectivity or if the user inadvertently closes the app.
The Results
Very’s team launched the first new iOS app within 8 months. It only took six months to push
the Android app out the door.
Since launching BACtrack View the company has experienced significant growth. The value
of the app goes far beyond dollars, though.
With Very’s help, BACtrack designed a highly accurate and reliable remote alcohol
monitoring service, providing recovering addicts with accountability and their loved
ones with peace of mind. Not only is the app earning the company money — it’s saving
countless lives.
Let's talk about your vision for a powerful IoT solution.