REST vs On-device SDK, what is the difference? | Huawei Health Kit comparison

Erman Derici
Huawei Developers
Published in
3 min readMar 29, 2024
Huawei Health

Greetings,
In this article we will talk about the main differences between REST implementation of Health Kit and the on-device SDK version of Health Kit.

Introduction

Huawei Health Kit allows you to read from or write data to Huawei Health. It is an excellent set of tools for fitness / health apps, providing you with an extensive and detailed APIs to help you make your dream health app, or improve your existing structure.

There are multiple platforms your users might be using, such as Android, IOS or even Web. If you wish to release your app on multiple platforms, then you need to be careful regarding your choice of Health Kit versions.

Provided Versions

Currently, Health Kit is available in 2 versions, Android / HarmonyOS (JavaScript) on-device SDK and Cloud version via REST API. The on-device SDK only works for the platform the SDK is built for, meaning if you use Android SDK your app can only implement Health Kit on Android platform. Cloud version however, allows you to develop your own REST endpoint for Health Kit, making it cross-platform.

Main Differences Between Versions — On-Device

Mobile Health Tracker App

On-device SDK allows you to quickly integrate Health Kit to your Android / HarmonyOS app and handles most of the authorization and authentication processes. It is very convenient and provides ready to use APIs for all sorts of data in your Huawei Health profile.

As the data is retrieved only when the user is using your app, this could mean that if you wanted to move the data to your own database, you’d need to do so when the app is running.

However, this implementation requires you to map, modify and customize some of the data on your own app. This could potentially increase the workload required to run your app as well.

This implementation also adds another dependency to your app.

Main Differences Between Versions — REST API

Huawei Health App

The REST API or the Cloud version does not have any dependencies you need to include, nor a module you need to import. The Cloud version is a set of REST API endpoints that you send requests to and receive data in return.

However, one of the biggest difficulties in this implementation is managing authorization and access tokens. You need to manage these keys manually, and if you have a multiple patient system integrate these keys to your database carefully.

Another difficulty is that since you are sending the HTTP requests, you need to make sure your requests satisfy the requirements of the endpoints. There are a lot of endpoints and a lot of parameters to keep track of!

Other than these downsides, the Cloud implementation allows you to create multi-platform apps with almost limitless customization options on your own backend. You can modify and customize the data returned to your own needs and handle these processes in your server instead of on end-user’s device.

Conclusion

In short, if you need to quickly integrate Health Kit capabilities to your Android or HarmonyOS app you can safely use the on-device SDK. The SDK will satisfy most of your needs and is very convenient to use. Otherwise, If you have your own server and wish to integrate the Health Kit capabilities to your own system, then we suggest that you use the Cloud version instead. The Cloud version allows you more freedom than the on-device SDK at the cost of being harder to use and implement.

Your app, your choice!

References

--

--