Google Fit is a health-tracking platform developed by Google for the Android operating system and Wear OS. It was announced at the Google I/O conference on June 25, 2014, and launched for public on October 28, 2014. It is a single set of APIs that blends data from multiple apps and devices. Google Fit uses sensors in a user’s activity tracker or mobile device to record physical fitness activities (such as walking or cycling), which are measured against the user’s fitness goals to provide a comprehensive view of their fitness. The app, Google Fit is available in google play store supports all Android devices running Android 4.0 or later, including smartwatches running Android Wear.
Why Google Fit is needed and how it helps?
Getting healthy is something that is on everyone’s mind at some point. Better health can lead to lower hospital bills, feeling better, and doing more things. Thus, the technology world is coming up with new innovations in digital health domain and Google Fit software development every day. Google Fit developers are leveraging the best out of them while walking hand-in-hand by adopting innovations like Google Fit SDK. Let’s Nurture, an ISO 9001:2015 certified mobile app development company based in Ahmedabad, India believes that Healthcare app development has opened up new possibilities in the domain of digital health.
You may like to read: 5 Fantastic IoT based Solutions in Healthcare Industry
With Google Fit SDK, Android developers get a list of APIs like Sensors API, Recording API, History API, Goals API etc. to read and write data into the central repository and manage the data as needed. The Fitness apps available on the Android device can be used to import data from various android supported wearable devices and that data is analyzed further to help users maintain a healthy and fit life. With the help of Google Fit, one can monitor daily health goals, heart points, bpm, calories burnt and many more.
Enough talking, let’s get some real time examples where Google Fit seems tremendous. As you can see, we have got some screenshots to show you guys how its useful in terms of fitness. As you can see it tracks your daily workout sessions through raw sensors and companion devices like wearables, smart bands etc. It tracks your Step counts, Calories burnt, distance traveled and many more. There are some newly introduced features like Heart Points and Move Min, I will brief you later about that in the same blog.
Alongside, the Home tab in the Google Fit app is where you’ll find something called Journal. This is the place where all of your workouts can be viewed. That’s whether they’ve been tracked from the app or a connected wearable device or added in manually.
Last but not least, There is another way to track your workout sessions in graphical representations. You can also add new activities up to 101 like Swimming, Aerobics, Badminton, Football, etc. to monitor.
What New In the Last Update?
The new Google Fit is centered around two simple and smart activity goals based on AHA and WHO’s activity recommendations shown to impact health: Move Minutes and Heart Points. Here is a brief introduction to earning these points.
- First up is Move minutes, which is essentially all about the amount of time you spend doing physical activity for a specific amount of time during the day. This could be doing some yoga or going out for a stroll or taking the stairs instead of the elevator. How many minutes you choose to move is determined by you. It’s set as a default to 60 minutes a day, but you are able to bump this up or reduce the amount.
- The next way to measure your activity goal is through something Google is calling Heart Points. Google Fit will award you points for more intense sessions of physical activity and when you’re really getting that heart pumping. You’ll earn one Heart Point for each minute of moderate activity, like picking up the pace when walking your dog, and double points for more intense activities like running.
How to work with Google Fit SDK?
Checking Google Play services availability
To use the Google Fit APIs, Android developers need google play services installed on their device. Google Fit is available on Android devices with Google Play services 7.0 or higher. Devices running Android 2.3 or higher that have the Google Play Store app automatically receive updates to Google Play services. To check which version of Google Play services is installed on your device, go to Settings > Apps > Google Play services.
Google Fit Latest Technical Features
Here is a Glimpse of functionality our android developers worked with
- Reading Steps count for current day using History client API
- Reading Calories burnt for current day using History client API
- Reading Heart Points for current day using History client API
- Inserting Calories burnt data for particular date using History client API
- Getting real-time data from raw sensors using Sensor client API
- Subscribe using Recording client API to record sensor data
Setting up the project in Google API Console
To use Fit SDK, Android developers need to select a project or create a new one in google API console. Next, we need to enable the Fitness API from APIs & Services. Then we need to get OAuth Client ID from credentials section. For more about how to get client id check this: Get an OAuth 2.0 client ID
In order to use google fit SDK, Android developers need to add below-mentioned dependencies to build .gradle file.
In order to access the data from Google Fit SDK, Android developers need two types of permissions: 1) Request app permissions ( Location and body sensors ) if your app needs to use distance, speed, and heart rate related features.
2) Permissions which are specified via Fitness data types. check the sample for more info :
First, we need to check if the user has previously granted the necessary data access, and if not, initiate the authorization flow which will ask user credentials for google account :
Working with Google Fit SDK
Fetching the data from Google Fit: Querying Sample in the base class
To get the data, our Android developers need to work with history client APIs of google fit SDK. Below code snippet reads user’s steps count data of today.
Also, we can read more than one type of data together. Below code snippet reads data of Steps, calories and heart points:
For that first, we need to create DataReadRequest builder which contains data types and time range of data.
From the above code, you can see that we have added Heart Points which are recently added in Google Fit SDK. To read Heart points we need to add data type TYPE_HEART_POINTS . Then we can request History client to get desired data as below :
Get Live Update from Sensor
If Android developers want to get a live update from different sources of fitness data (hardware sensors, companion devices) in local and connected devices then we need to use Sensors API. Here is a quick code for that:
Inserting data to Google Fit
In order to batch insertion of data android developer need to use insertData(DataSet) of History client APIs. To Insert data first Android developer needs to create a DataSource as below snippet:
Essential apps and devices that work with Google Fit
- Well, here is a list of apps that works with Google: Strava, Instant, Minute Workout, Lose It, Daily Yoga etc. I will take use case of Strava app to show you the steps required to connect with Google Fit. The option to connect with Google Fit is available on the Strava app’s activity save screen, by editing your profile, and under Settings > Link Other Services. Once you done with sync process, Strava will send activity time, distance, and calories to Google Fit and will receive weight from Google Fit. Simple, right? This is how fitness apps work with Google Fit.
- Now, let’s talk about Fitness trackers that you can use with Google Fit. The first name comes in my mind is FitBit, you need to log in with the google account and allow Google Fit Synchronization to make it happen with Google Fit API Integration. Then fitbit will start tracking your activities like exercise, food, weight, and sleep. There are other fitness trackers like Gramin, Xiaomi etc.
- We at Let’s Nurture have developed many apps. I would like to mention one of them: MedCheck. We use IoT-enabled medical devices and AI-enabled algorithms to offer unique subscription service to help corporates measure health and wellness metrics of their workforce through the provision of easy-to-use, portable and wireless-enabled health check-up kiosk at their premises. With the help of Medcheck app, we can read steps count and other activity data from Google Fit. Have a look at our work :
How Let’s Nurture helps in delivering Digital Health Solutions with Google Fit?
Let’s Nurture, a leading IT company known for custom android mobile app development in India has got the expertise in providing many solutions for healthcare app development, using frameworks like Google Fit which helps to store, fetching, writing and analyzing health-related data into Android applications. We at Let’s Nurture can provide solutions for people, interested in digital health solutions and much more based on applications for healthcare using wearables IoT and Google Fit.
You can also hire dedicated android developers at affordable prices with flexible engagement models as per your business needs.
If you want to know more about digital Healthcare Solutions with Google Fit and Android fitness app development or want to implement this technology in your existing mobile app, get a free consultation from our Android experts at Let’s Nurture.