How-tos: Using SDKs
Everything given in one kit
It would be an absolute nightmare if you ever tried building one of those IKEA tables without one of those hexagon keys or hexagon screwdrivers.. you know which ones I'm talking about. These things are part of a Tool Kit and they are really useful because they let you nail something, screw something, or twist something way easier (and more secure) than if you tried with your bare hands or a makeshift hammer with a branch.
Similarly, Software Development Kits (SDKs) do the same for developers! They abstract things into easy-to-use tools so you do not have to implement them completely from scratch.
Definition
SDKs are generally made in a way that would have a specific use case for a specific platform. However they usually all have some things in common.
SDKs would generally contain tools such as:
- Compiler - This allows you to work in the programming language you want
- Debugger - Helps you find bugs in your code as you implement new functionality
- API - An interface that allows your application to interact with others
- Documentation - A whole bunch of text telling you how to use the SDK
- Testing Tools - Tools to let you test your application
- Code Samples - Some code showing you examples of how to use the SDK
The Power of SDKs
There are so many SDKs out there that allow you to do much neat stuff. Terra provides a few SDKs for easy connections to different Health Data providers such as Apple, Samsung, and Google Fit.
Of course, every SDK would come with its own installation instructions. It is always crucial to follow them step by step to make sure the installation is done properly. At Terra, we try to make everything as simple as possible for developers. Our Android SDKs are a one line instalment in your gradle file.
Let us test out the TerraAndroid SDK to send Google Fit Activity data to your webhook through Terra (You can sign up here). Through Android Studio (which actually lets you use the Android SDKs to help you build, develop, compile, debug, and test Android Apps!), installation is done in one line inside your build.gradle
file under your app:
implementation 'co.tryterra:terra-android:1.0.4'
Running this, and syncing your gradle files, allows you to access every exported function, classes, constants, enums, etc contained within the SDK.
We can start development with it now:
Instantiating the Terra
class now, you may initiate a connection to any of the integrations allowed in the SDK.
Let us do a Google Fit SDK connection. Following TerraAndroid SDK instructions, I have created a project on Google Developer Console, set up the OAuth consent screen with the scopes required by the SDK, and created a new Android App OAuth Client.
Doing this now, I can go back on Android studio and get my Activity data for today from Google Fit in a couple function calls:
Running this function would trigger the SDK to prompt for permissions, grab the data and send this data to your backend:
Now you may compare this to you having to deal with the Permission handling, getting data per each data point from Google (Heart rate, steps, calories, distance, etc), filtering the activity segments, and parsing the response into a coherent model. You might then want it sent to your backend as well. All of this was abstracted away from you by the SDK and you simply have to run the one function to get the Activity Data.
Develop at 10x speed
The example above is just a very simple and general use case of a type of SDK. As mentioned before, an SDK can contain a lot more and can be a lot more broad, such as the Android SDK. However, the idea is that they are there to simplify your code (and your life), and save you hours on implementing something that is already done.
Search on Google to see if the tool you need exist, install it and start building your app! If there are no such tools, then of course... starting from first principles is always a good start ;)