Introducing HeartWatch

It took Piotr and me quite some time, but the first release is now ready.

HeartWatch gives you a unique way to monitor the heart rate of elder people or anyone suffering from heart diseases. It allows you to request an instant, remote pulse measurement with just a single tap, at any time and from anywhere.

You can grab the apk on Google Play or watch a short preview:

When I’m writing this, our app is the only one on Google Play that allows to remotely check someone’s heart rate. I was responsible for the mobile app and Piotr did the API part (ASP.NET WebAPI on Azure platform).

We’ve started the development before the Android Design Support library was released at I/O ’15, so initially I had to recreate many parts of “material” UI manually (like NavigationView), following Google’s cheat sheet, or use some really good 3rd party libraries, like FloatingActionButton or Snackbar.

Retrofit and OkHttp were used for the API communication, with Gson and its custom adapters (mainly for time-related fields from Joda-Time) for automatic JSON deserialization.

For pulse measurement requests, alerts and other notifications, we’ve used Azure’s Notification Hub, which is basically Microsoft’s interface for Google Cloud Messaging.

Database runs on a cloud version of MS SQL Server (v12) located somewhere over the rainbow in East US.

Samsung Gear Live that we bought few months ago was our Android Wear test device.

Main features

  • Remotely check the heart rate of your close friends and family members (they’re required to have an Android Wear smartwatch equipped with a heart rate monitor).
  • Remotely check the heart rate of your close friends and family members (they’re required to have an Android Wear smartwatch equipped with a heart rate monitor).
  • Set automatic periodic heart rate measurements for them.
  • Choose a suitable measurement duration.
  • Receive notifications when your friend’s heart rate goes out of a specified range.
  • Get quick access to contact data and GPS location of your friend in case of emergency.
  • Browse the history of measurements.
  • Inspect the data in charts.
  • Automatic activity recognition for measurements (walking, running, cycling, driving).
  • Android Wear integration, including a wearable app.
  • Start a heart rate check via voice command by speaking to your watch or phone (e.g. “Ok Google, check my pulse”, “Ok Google, what’s my bpm?” etc.).
  • Seamlessly sync measurements to Google Fit and integrate the data with other sources.
  • Material Design touch

Requirements

  • An Android Wear smartwatch equipped with a heart rate monitor for you or your friend
  • Android Wear app (available in Play Store)
  • Google+ account for quick and secure sign-in
  • Internet connection

Shared “checkable” behavior across all groups in NavigationView

I’m not sure why Google not only did not provide a straightforward API to customize such basic property, but also chose to set the default behavior to be rather undesirable in most cases.

I’ve asked a question on Stack Overflow and on the next day I provided a quick solution. Here’s the snippet:

Step 1: Remove

android:checkableBehavior="single"

from all groups.

Step 2: Add

android:checkable="true"

to all items in all groups.

Step 3: Add the following logic to your OnNavigationItemSelectedListener:

mNavigationView.setNavigationItemSelectedListener(
            new NavigationView.OnNavigationItemSelectedListener() {
                @Override
                public boolean onNavigationItemSelected(MenuItem menuItem) {
                    menuItem.setChecked(true);
                    if (mPreviousMenuItem != null) {
                        mPreviousMenuItem.setChecked(false);
                    }
                    mPreviousMenuItem = menuItem;
                    //...
                    changeCurrentFragment(...);
                    return true;
                }
            });