I would like to request the thunkable staff team to add a feature that data can be fetched from googlefit
Thanks for the request @lolxdyt6950as - as wearables continue to grow in popularity this is something we’ll have to consider going forward.
In the meantime, do you know if Google Fit has an API?
If so, then you can pull this data into your Thunkable app today with our Web API component.
Hope that helps!
Yes! Google Fit has APIs
Can you help me set these up?
Here is the API info: Android APIs  | Google Fit  | Google Developers
If it works, then maybe a pedometer will be possible in thunkable, i think?
now what should i do here?
If you’re new to using APIs the check out the Thunkable Academy
There are several tutorials there to help you go from novice to advanced user in just a few steps!
Let us know how it goes!
dang ok i found yet another way to integrate google fit
just have to decompile the app and put it in android studio
then set it up as google intended lol
edit: no i have problems still
new problem forum link: Decompiling a app
Using the web api would be much simpler than decompiling the app. Are you a traditional developer and using noCode as a bridge gapper?
What issues are you experiencing using the webAPI. Looks like you need to integrate OAuth from google. are you familiiar with doing that?
Google Fit has REST API end pints which you can use. The API is as follows:
GET https://www.googleapis.com/fitness/v1/users/{userId}/dataSources/{dataSourceId}/datasets/{datasetId}
Following is the explanation of the parameters:
- userId should be me
- dataSourceId you will need another API to find it out if you do not have it stored.
- datasetId is the start time and end time in the form of EPOCH using the format
startTime-endTime
.
To obtain the dataSourceId use the following API:
GET https://www.googleapis.com/fitness/v1/users/userId/dataSources
The user ID running the API should have authorization to the following (from Google Docs)
No, im not familier with web api…
2: no im not a traditional developer, i was just using thunkable cuz its easy and fast
3: i dont know how to use webapi
4: no im not
edit: muneer answered me and explained
thanks dude. your explaination was good but i am not understanding {datasetId}
- datasetId is the start time and end time in the form of EPOCH using the format
startTime-endTime
. - How do i fetch the user id
You need an access token. You can do this in a variety of ways.
how will i get a access token?
It’s quite a bit of setup. Atm, you need a supporting website which can be hosted on your Firebase instance.
If you’re interested in learning, I offer paid coaching sessions to bring you up to speed quickly!
i cant afford paid courses
maybe now i have to figure it out
An Epoch is a time represented in the number of milliseconds since 1970
The time I stared this response the Epoch was
1662225491628
Google require that in nanoseconds so add 000 to it.
and how to get the datasourceId?
See my message, you need to use the other API that I explained in my answer.
now i have use these api to check:
- userID: me
- datasourceId: unable to fetch
- datasetID: 000
this is what returned:
{
“error”: {
“code”: 401,
“message”: “Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.”,
“errors”: [
{
“message”: “Login Required.”,
“domain”: “global”,
“reason”: “required”,
“location”: “Authorization”,
“locationType”: “header”
}
],
“status”: “UNAUTHENTICATED”,
“details”: [
{
“@type”: “type.googleapis.com/google.rpc.ErrorInfo”,
“reason”: “CREDENTIALS_MISSING”,
“domain”: “googleapis.com”,
“metadata”: {
“method”: “google.android.fitness.v1.FitnessService.ListDataSources”,
“service”: “fitness.googleapis.com”
}
}
]
}
}
You need to select a dataSourceId
.
You can use Google Playground to define the scope which is required and to get OAuth credentials.