[MUSIC PLAYING]
CHRIS WILK: Hi, everyone.
My name is Chris Wilk, and I am the product lead
for Health Connect.
SARA HAMILTON: And I'm Sara Hamilton, an Android developer
advocate focused on helping developers
build health and fitness experiences on Android.
CHRIS WILK: Today we're going to talk to you about Health
Connect by Android.
Health Connect is a new platform that
helps Android users securely store health and wellness
data on their phone, and it gives them a simple way
to connect and share this data with their favorite apps.
For developers like you, it is a new common API for Android.
With user permission, you'll be able to securely access
this health and wellness data.
In this session, Sara and I will give you
an overview of the platform and how it works.
Let's get started.
On Google Play, there are thousands
of apps that help users achieve their personal wellness goals,
whether that be staying more active,
sleeping better, or tracking a fertility journey.
Now more than ever, people use multiple devices
to track and measure their progress.
Phones can track steps or even detect
snoring during the night.
Wearables can monitor heart rate and measure stress,
and health at home devices can accurately
track your blood pressure.
All of these apps and devices generate
a lot of interesting data and really valuable data
for the user.
This data is helpful on its own, letting
users answer straightforward questions like,
did I meet my activity goals today?
How well did I sleep last night?
How is my weight trending?
This data is powerful when combined, giving users
a deeper picture into their health and well-being
and actionable insights.
Say, based on my vitals, am I ready for a high intensity
workout today, or should I just go for a walk?
Does meditation in bed help me fall asleep easily?
Is my fitness and nutrition plan working for me?
So the first step was to talk to our users to deeply understand
what they wanted, and we found that they did see
the value in connecting and sharing
data between their health and wellness apps.
But they found consistently that data is trapped within each app
or service that they use, and this
is because Android doesn't currently
offer a consistent way to share health data between the apps.
We thought we could fix this.
We found that users wanted to see all of their data
in one place, and they want to choose which
app they want to see it in.
We thought we could help here too.
Importantly, we found that users need
to stay in control of their privacy
and know that their data is secure,
so privacy controls have to be at the heart of our solution.
We listened to our developer community.
Overwhelmingly, we heard that the number of platforms
your apps need to integrate with on Android and maintain
is really challenging.
Each API has a different schema and different API behaviors.
This is not only time-consuming, but it is actually
very costly to your business.
We want to solve these problems by creating
a universal solution for Android.
No matter which devices your users use
or which apps they choose to use, it will work for them.
We want to create common standards with the help
of our developer community.
This makes it easier to use the data
so that you can bring better insights
and experiences to your users.
And with a common platform, you will
benefit from reaching more users with less work.
Our long-term vision is to help you
reach 3 billion-plus Android users with one integration,
and we've been working very hard to bring this to life.
Today we're so excited to introduce you to Health Connect
by Android.
Health Connect is a common API for storing and sharing
health data on Android phones.
Developers can read from and write data
to an on-device data store.
We've standardized the schema and API behavior,
making it easy for you to use the data.
We centralized the permissions and the privacy controls,
making it clear and simple for your users
to manage this data and access to it.
We are so happy to announce we're bringing together
Fitbit, Google Fit, and Samsung Health
under this one united API.
We've designed and developed this platform in collaboration
with these leading health and wellness apps,
and we'll hear more from Sara about those partners
in a moment.
Out of the box, Health Connect supports more than 50 data
types across 6 categories.
So that's activity, including exercises; sleep; nutrition;
cycle tracking; body measurements; and, of course,
your vitals, things like your heart rate
and your blood pressure.
So with user permission, apps can
write data into Health Connect as well as read it back out.
Health Connect is designed to give users
full control over their privacy.
Users can easily see what the app is requesting access to,
toggle access on and off at any time,
delete data they don't want anymore,
and manage the priority of those data sources.
So our toolkit for building health and wellness
apps on Android is expanding and ever-evolving.
Health Services provides an access
to real time sensor data on Wear OS in a power efficient way.
We introduced this last year, and it's now in beta.
Check out the Wear OS technical session for this year's update.
Health Connect allows access to health and wellness
data stored on your phone.
Web APIs for both Fitbit and Google Fit
allow access to health and wellness data
stored in the cloud, which is associated with the user's
Google or Fitbit account.
Both Health Services and Health Connect
have streamlined our API offering on Android.
So Health Connect becomes the new way for Android apps
to sync data with Google Fit on device.
So this means that the existing Google Fit Android
APIs will be deprecated.
We will continue to invest in the web APIs
that we've already mentioned.
We know this migration will take some time,
and that's why developers using Google Fit Android APIs today
should visit the documentation for guidance on what to do.
Health Connect is available to developers today.
The alpha SDK is available from Android Jetpack.
We have published the privacy and security policy online,
and the app is available from Google Play,
so sign up for the open beta.
So when will users see the benefit?
So Health Connect will be available to users this fall.
This is when the Health Connect app will
be released to everybody and when the first part
integrations will go live.
Sara is going to show you how it all works now.
SARA HAMILTON: So now I'll talk about how
you can use Health Connect in your own Android app.
I'll discuss a hypothetical reproductive health app
as an example.
The app lets users share data about their menstrual cycles
with their favorite health apps and reads
in nutrition and activity data to provide better insights
to their users.
I'll review the high level architecture
of how an app like this would use Health Connect,
and then I'll dive into some code examples.
So Health Connect provides an SDK
that apps can use to integrate with the API.
It also provides an app for users,
which is available via Play Store in beta
and will come preinstalled on some Android devices
later this year.
If the user hasn't installed Health Connect yet,
don't worry.
When you call the Health Connect SDK,
the user will be brought through a download flow
to install the app.
So first the app requests permissions from the users.
After getting permissions, the app
can write in data to Health Connect storage on device,
and then other apps that the user has granted permission
to will also be writing to Health Connect.
Then the app can read back the data the user is interested in.
In this reproductive health example,
the app reads in nutrition data and activity data.
Before moving into details, I wanted
to highlight a helpful component of the Developer
Toolkit, Health Services.
Developers can use the Health Services
API to collect real time sensor data from Wear OS in a power
efficient way.
Once collected, you can use Health Connect
to store and share the data with other apps.
Check out our documentation for more info
on how you can use both Health Services and Health Connect
together.
So now I'll read down the example above and show
how to actually build this.
So let's start with requesting permissions.
Privacy is central to Health Connect.
An app must get user approval for fine-grained permissions
for each individual data type it wants to read or write.
Adding any additional data types requires
requesting that specific permission from the user.
So a user will see a permission request screen
in the Health Connect UI where they
can toggle access for different data types on or off.
The UI also displays a list of existing permission settings
in the apps that are connected.
A user can remove a specific data type
permission or an app's permission from this UI
at any time.
As a note, these permission screens
are the primary UI for Health Connect.
This is because we want users to have a single place
to manage their data privacy, and we
want users to view the data and insights primarily
in their favorite health and fitness apps.
With just a few lines of code, an app
can request the fine-grained read and write permissions.
This snippet will launch the UI screen that I just discussed.
So first build a set of permissions
the app is interested in.
In this example, we want to write menstrual cycle data
and read nutrition and activity data.
So as you can see, we need a line for every single type.
Then launch the permissions request and check the result.
So once the user has granted the app permissions,
the app can write data.
Health Connect supports over 50 common data types.
These data types are specifiers for common types
of health and fitness data and their formats.
So here are a few examples of data types
related to reproductive health and to activity,
just to give you an idea of what these data types look like.
For activity data, the data can be
grouped into activity sessions to track
all the metrics associated to one workout together.
When you're writing, the data can be formatted
in a few different ways.
Our goal is for these formats to give you the flexibility
to read and write the data you need while still maintaining
a consistent format.
Sample data is an instantaneous measurement, like meals,
weight, or resting heart rate at a given moment.
Interval data is a measurement that
has a start time and an end time,
so this could be the number of calories burned from the start
to the end of a workout.
Series data is suited for high frequency sensor data,
like continuous heart rate samples during an activity.
This is how to write data.
So compose a list of records, which in this case
is a single menstruation entry, but this could also
be a longer list of different types.
And after getting permissions, then you
can write the data to Health Connect storage
on device, which you can see here.
So now I'll show you how to read data.
You can read back a single data entry using the unique ID
for that piece of data, or you can read back all the records
from a given time frame.
Health Connect also provides aggregated data.
There are a few different types of aggregations.
Statistical provides the average minimum
or maximum values in a set, like the maximum heart
rate during a workout.
Cumulative provides the sum of values over a given time range,
like the total step count in a day.
Count just provides a simple count
of the number of data entries, like number
of workouts in a week.
And duration provides the total duration
of one type of data values, like the time
spent sleeping this week.
Health Connect will dedupe data for you across multiple sources
and return a single record.
Users can choose the merging priority
within the Health Connect UI if there
are two or more data points of the same type
within the same period.
So here's how you can read back the user's total steps stored
in Health Connect, which could be recorded
by any of the user's favorite fitness apps
that they've granted permissions to.
So you choose a set of metrics you'd like to retrieve,
so steps; the start and end time;
and an optional data origin filter.
Here I pass an empty list, as I don't want a filter,
but you could optionally add a subset of apps.
Then request the metrics from Health Connect.
So in summary, with the simple snippets
I showed, the app now enables the user
to share their menstrual cycle data with their favorite health
and fitness apps, and the app can allow the user
to pull in activity data from their favorite fitness
trackers, all while giving a user full control over exactly
what data is stored and shared.
Now that I've shared a bit about how to develop using the Health
Connect API, I'll explain how some real developers
have been using it.
I'd like to introduce you to some of the partners
we've been working with in our early access program.
I'll deep dive into two of these partners integrations
to show you how they're using Health Connect.
So we're really excited to partner with Withings
whose award-winning health ecosystem of connected devices
and apps is designed to improve daily well-being
and long-term health.
Withings has an ecosystem of connected health devices.
For example, they have a smart blood pressure monitor
that can provide medically accurate blood pressure
and heart rate readings and a smart thermometer that
yields medical grade results.
Through their Health Mate apps integration
with Health Connect, users can now share the Withings data
throughout the ecosystem.
Once Health Connect is activated in Withings Health Mate
application, users choose the health data they want to share.
Health Connect brings together Withings data and external data
from other applications on the phone so
that users keep track of their activity and health data
as a whole, enjoying all the benefits of Health Mate
application monitoring.
Health Mate processes all this data
to solve conflicts and avoid duplicates or inconsistencies,
and their data visualization highlights each data source
to better identify the origin.
Withings are reading and writing a rich set of data types
in this integration, including activities and workouts, VO2
max, sleep, oxygen saturation, and muscle and fat mass.
We've gotten some really positive feedback
from the Withings team on their integration,
and I wanted to share a quote from their product owner, who
said, "At Withings, we believe that we can be healthier
together.
We are committed to helping users share and use
their health data.
Whether it's with health reports for health care professionals
or sports performance with their friends,
Health Platform is a powerful tool
for sharing data while remaining secure, simple,
and centralized."
As a second example, we are partnering with MyFitnessPal.
MyFitnessPal is the number one nutrition and food tracking
app in the world, helping nearly 1 million members reach
their nutrition and fitness goals every year.
Their database of over 14 million foods
allows users to get a complete picture of their nutrition.
MyFitnessPal users want a comprehensive picture
of their health and wellness activities,
but this data can exist across many different health
and fitness apps.
With Health Connect, MyFitnessPal users
can connect data from all their favorite health
and fitness apps in one place.
Here's how it works.
MyFitnessPal writes their nutrition data
into Health Connect, bringing the info
from their full database of foods.
So all the micro and macronutrients
associated with a food will be stored in Health Connect.
And then MyFitnessPal reads in activity data
from Health Connect, making it easy for users
to see all their workouts in one place with just a single data
connection.
This enables users to see an accurate view of their health,
including the calories they've taken
in and burned in their activity, all within the MyFitnessPal
app.
It has been great working with the MyFitnessPal team on this.
I wanted to share a quote from their CEO who
said, "MyFitnessPal is thrilled to be
a premier partner of Health Connect,
bringing comprehensive global nutrition data to our Android
members and allowing them to have
a holistic picture of and insights into their health
and wellness."
Those are just two of our partners,
but we've been working with a variety of others
who are leaders in their verticals as well.
We're really looking forward to the launches
of these integrations, which are coming soon.
And now back to you, Chris.
CHRIS WILK: OK, to recap, Health Connect
is available to developers today,
so go get the SDK from Android Jetpack,
review the privacy and security policy, and for the app,
sign up for the open beta via Google Play.
We would love for you to be part of our launch with the users
this fall alongside our early access
partners and, of course, Fitbit, Google Fit, and Samsung Health.
Please visit developer.android.com/health
connect for the SDK, documentation, code samples,
and links to the privacy and security policy.
That's the end of our session today.
With Health Connect, we believe we
can help users achieve their health and wellness
goals while keeping them in control of their privacy
and making sure that their data is safe and secure.
Thank you all for listening.
[MUSIC PLAYING]