Step By Step Guide To Implementing Android Google Fit And iOS Health Kit

Living a healthy life is a modern and prevalent trend, which is increasing the market for fitness tracking apps. Basically, tracking apps are designed to track and analyze user daily activity information and notify them about their activity targets and achievements. Built upon the data, a company can offer an excellent mobile solution to customers that allows customers to do more with the data.

No surprise that Google and Apple are working directly on several fronts to piggyback on the opportunity. Whether in terms of wearables, the Internet of things, mobile applications or mobile OS — there is a massive competition between both.

Google introduced its healthcare platform ‘Google Fit’, which utilizes its APIs to track its fitness activities. With iOS 8, Apple launched the Health Kit framework that works alongside its health apps.

What Is Google Fit?

Google Fit is a health-tracking platform developed by Google for Android. Google Fit uses sensors in a user’s activity tracker or mobile device to record physical fitness activities (such as walking, cycling, etc.).

In the first part of this article, we will cover the built-in framework provided by Google. To develop such applications, you require technical knowledge and a clear understanding of the components.

Google Fit Components

  • The Fitness Store- A central repository that stores data from a variety of devices and apps. The fitness store is a cloud service that is available to clients.
  • The Sensor Framework- A set of high-level representations that make it easy to work with the fitness store. You use these representations with the Google Fit APIs.
  • Permission and User Controls- A set of authorization scopes to request user permission to work with health and wellness data.
  • Google Fit API- Android and REST APIs to access the fitness store. You can create apps that support Google Fit on multiple platforms and devices, such as Android, iOS, and Web apps.

How Does Google Fit Work?

platform overview Image
Fig: Platform overview Image

Type Of APIs

The Google Fit APIs for Android are part of Google Play services and are supported in Android 2.3 (API level 9) and higher. Google Fit on Android consists of these APIs:

  • History API- The History API enables your app to perform bulk operations on the fitness store: reading, inserting, updating, and deleting historical health and wellness data.
  • Sensor API- The Sensors API provides access to raw sensor data streams from sensors available on the Android device and sensors available in companion devices, such as wearables.
  • Recording API- The Recording API provides automated storage of health and wellness data using subscriptions. Google Fit stores health and wellness data of the specified types in the background and persist app subscriptions.
  • Session API- The Sessions API provides functionality to store health and wellness data with session metadata. Sessions represent a time interval during which users perform a fitness activity.
  • Goals API- The Goals API provides a way to track users’ goals for their health and fitness progress.

Steps For Implementation

  • Settings on the Google Console
  1. Go to Google Search Console.
  2. If you have a Google Analytics login, then use the exact details. If you don’t have the account in that case, you need to login first.
  3. Once you have completed the login process, click the button called “Add A Property” top of the page.
  4. To continue the process, Enter the correct URL of your website
  5. Next, you will be asked to verify that you own the website in one of four ways
  6. If you already have a Google Analytics Tracking ID installed, and we would highly recommend that you do, then setting up
  7. Google Search Console is very easy. Simply click the Verify button, and that’s it!
  • Android Project Setup
  1. Install the latest version of Android Studio.
  2. In the Welcome to Android Studio window, click Create New Project.
  3. If you have a project already opened, select File > New > New Project.
  4. In the Select, a Project Template window, select Empty Activity and click Next.
  5. In the Configure your project window, complete the following:
  • Enter “My First App” in the Name field.
  • Enter “com.example.myfirstapp” in the Package name field.
  • If you’d like to place the project in a different folder, change its Save location.
  • Select either Java or Kotlin from the Language drop-down menu.
  • Select the lowest version of Android your app will support in the Minimum SDK field.
  • If your app will require legacy library support, mark the Use legacy android. Support libraries checkbox.

Leave the other options as they are.

6. Click Finish

Connect to the fitness service

  • Get the necessary OAuth authentication-
  • Get the necessary Android permissions
  • Create an API client and use API’s

Here is the Demo

What Is HealthKit?

HealthKit is a central repository for health and fitness data on iPhone and Apple watch. The Healthcare framework was introduced in 2014 alongside iOS 8. It provides a solution for storing, managing, and sharing health and fitness data within new applications with the user’s permission to maintain security.

How Does It Work?

Accessing & storing health & fitness data

There are three main ways to access data from the HealthKit Store to the fitness service.

  • Direct method call
  • Queries
  • Long-running queries

Saving Data to HealthKit

  • Create & Share Healthkit samples
  • Save data

How To Implement Apple HealthKit?

  • Enable HealthKit for your app into Xcode
  • Ensure that HealthKit is available on the current device
  • Create your app’s HealthKit Store
  • Request user permissions to read and share data
  • Access and share data with your Store by using predefined classes and Data Types provided by HealthKit Store.

Here is Demo

3 Quick iOS UI Hacks That You Can Learn In 5 Minutes And Will Help You Forever

coma

Conclusion

Hope you like our in-depth article on Google Fit and Health Kit framework development process. You can Contact the Mindbowser team for your fitness app development plan.

This Blog was written by Ashvini, Krupa, Kiran, Priyanka and Vikram, members of the Mindbowser mobility team and modified by the Mindbowser Content team for publication purposes.

Source-

https://developers.google.com/fit/overview
https://developer.android.com/training/basics/firstapp/creating-project

Content Team

This blog is from Mindbowser‘s content team – a group of individuals coming together to create pieces that you may like. If you have feedback, please drop us a message on contact@mindbowser.com
We do publish often and our blogs are often accompanied by research and surveys. If you would like to be the first to receive an update on whenever we publish, subscribe to our newsletter.

The founder's survey report on "What Matters For Startup" is released - Get your copy and learn the trends of successful companies :)

Download Free eBook Now!

Get in touch for a detailed discussion.

Hear From Our 100+ Customers
coma

Mindbowser helped us build an awesome iOS app to bring balance to people’s lives.

author
ADDIE WOOTTEN
CEO, SMILINGMIND
coma

We had very close go live timeline and MindBowser team got us live a month before.

author
Shaz Khan
CEO, BuyNow WorldWide
coma

They were a very responsive team! Extremely easy to communicate and work with!

author
Kristen M.
Founder & CEO, TotTech
coma

We’ve had very little-to-no hiccups at all—it’s been a really pleasurable experience.

author
Chacko Thomas
Co-Founder, TEAM8s
coma

Mindbowser is one of the reasons that our app is successful. These guys have been a great team.

author
Dave Dubier
Founder & CEO, MangoMirror
coma

"Mindbowser was very helpful with explaining the development process and started quickly on the project."

author
Hieu Le
Executive Director of Product Development, Innovation Lab
coma

"The greatest benefit we got from Mindbowser is the expertise. Their team has developed apps in all different industries with all types of social proofs."

author
Alex Gobel
Co-Founder, Vesica
coma

Mindbowser is professional, efficient and thorough. 

author
MacKenzie R
Consultant at XPRIZE
coma

Very committed, they create beautiful apps and are very benevolent. They have brilliant Ideas.

author
Laurie Mastrogiani
Founder, S.T.A.R.S of Wellness
coma

MindBowser was great; they listened to us a lot and helped us hone in on the actual idea of the app.” “They had put together fantastic wireframes for us.

author
Bennet Gillogly
Co-Founder, Flat Earth
coma

"They're very tech-savvy, yet humble."

author
Uma Nidmarty
CEO, GS Advisorate, Inc.
coma

"Ayush was responsive and paired me with the best team member possible, to complete my complex vision and project. Could not be happier"

author
Katie Taylor
Founder, Child Life On Call
coma

“As a founder of a budding start up, it has been a great experience working with Mindbower Inc under Ayush's leadership for our online digital platform design and development activity."

author
Radhika Kotwal
Founder of Courtyardly
coma

The team from Mindbowser stayed on task, asked the right questions, and completed the required tasks in a timely fashion! Strong work team!

author
Michael Wright
Chief Executive Officer, SDOH2Health LLC
coma

They are focused, patient and; they are innovative. Please give them a shot if you are looking for someone to partner with, you can go along with Mindbowser.

author
David Cain
CEO, thirty2give