google-fit-sdk

How to get weight data from Google fitness api?

我与影子孤独终老i 提交于 2021-02-07 09:33:35
问题 Existing script for step count works perfectly and I can get the data from Google Fit // see step count example at https://developers.google.com/fit/scenarios/read-daily- step-total function getSteps() { var start = new Date(); start.setHours(0,0,0,0); start.setDate(start.getDate()-1); var end = new Date(); end.setHours(23,59,59,999); end.setDate(end.getDate()-1); var fitService = getFitService(); var request = { "aggregateBy": [{ "dataTypeName": "com.google.step_count.delta", "dataSourceId":

Google Fitness: Dealing with TransactionTooLargeException without feedback

冷暖自知 提交于 2021-01-28 01:08:04
问题 I'm building an application integrating with Google Fit via the local (not REST) Google Fit API. I'm using Flutter 1.2.1, Kotlin 1.3.21, com.google.android.gms:play-services-fitness:16.0.1 and running the app on Android 8.1.0 with Google Play Services 16.0.89. Some HistoryClient.readData() requests disappear without any feedback (no calls to onSuccessListener, onCancelledListener, onFailureListener, onCompleteListener callbacks), and at these times I can see in the logs: W/Fitness: Error

Android ACTIVITY_RECOGNITION Permission SDK 28 running on Android 10/Q (SDK 29)

本秂侑毒 提交于 2020-08-02 04:15:35
问题 My Android app targets SDK 28 and connects to Google Fit to upload data and read some other data. The app uses the HistoryAPI to read com.google.step_count.delta data. This documentation claims that "com.google.android.gms.permission.ACTIVITY_RECOGNITION permission is converted into a pre-granted runtime permission" if the app targets SDK 28 but runs on SDK 29: https://developers.google.com/fit/android/authorization#android_permissions I have added to the app's manifest like the documentation

Android ACTIVITY_RECOGNITION Permission SDK 28 running on Android 10/Q (SDK 29)

*爱你&永不变心* 提交于 2020-08-02 04:14:36
问题 My Android app targets SDK 28 and connects to Google Fit to upload data and read some other data. The app uses the HistoryAPI to read com.google.step_count.delta data. This documentation claims that "com.google.android.gms.permission.ACTIVITY_RECOGNITION permission is converted into a pre-granted runtime permission" if the app targets SDK 28 but runs on SDK 29: https://developers.google.com/fit/android/authorization#android_permissions I have added to the app's manifest like the documentation

Get current day's steps during datapointListener google Fit

北慕城南 提交于 2020-03-02 07:50:26
问题 Using the following code, I get the cumulative steps since I started recording the values. But I would like to show only the current day's steps instead of cumulative. @Override public void onConnected(@Nullable Bundle bundle) { DataSourcesRequest dataSourceRequest = new DataSourcesRequest.Builder() .setDataTypes(DataType.TYPE_STEP_COUNT_CUMULATIVE) .setDataSourceTypes(DataSource.TYPE_RAW) .build(); ResultCallback<DataSourcesResult> dataSourcesResultCallback = new ResultCallback

Fitness getSensorsClient Can not read TYPE_ACTIVITY_SEGMENT real time data

久未见 提交于 2020-01-16 14:04:28
问题 Objective - Get continuous call back of activity (like - walking, running, etc. data) , read the real data for activities. I can read real time data for TYPE_LOCATION_SAMPLE for same code as below just changing to TYPE_ACTIVITY_SEGMENT. i can not read the real data for activities like - walking, running, etc. Example - https://developers.google.com/fit/rest/v1/reference/activity-types [Google fit - Read using getSensorsClient] Read Example - Walking* 7 Walking (fitness) 93 Following - https:/

Can't get heart rate data from google fit API with smartband 2

有些话、适合烂在心里 提交于 2020-01-05 10:34:52
问题 I'm trying to use google Fit API to get heartrate from sony smartband2. Problem is, I don't get any readings(i.e. onDataPoint method is not called). Heart Rate sensor is being found properly, whole code also is working properly if I try to look for step data. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { authInProgress = savedInstanceState.getBoolean(AUTH_PENDING); } mApiClient

GoogleApiClient not connecting while using google fit

天大地大妈咪最大 提交于 2020-01-04 06:15:11
问题 I am trying to get the data for number of steps walked using google fit. I am implementing the code from this tutorial. I am being asked for the account from which I want to connect google fit. After I select the account, it is not connecting. After I select the account, onActivityResult is called but mApiClient.isConnecting() && mApiClient.isConnected() are both false and resultCode == RESULT_CANCELED . Hence, the next alert dialog for requesting permission to access fit data is not being

Steps Data receive from History api is not matched with google fit

*爱你&永不变心* 提交于 2020-01-03 03:20:08
问题 I want google fit steps count in my application, for that I am using History api, provided by google. I found that steps receive from history api is not matched with google fit even if i used same code provided by google. Below is my code. Calendar cal = Calendar.getInstance(); Date now = new Date(); cal.setTime(now); long endTime = cal.getTimeInMillis(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); long startTime = cal.getTimeInMillis();

Getting active time from Google Fit Rest API

爷,独闯天下 提交于 2019-12-31 01:26:12
问题 I am struggling with matching the "active time" returned by Fit REST API with reality. As an example - on 12/14 I had two walks, about 45 minutes each. The api returns one of them as type 7 ("walking" - right!) and another one as type 0 (in vehicle - wrong!). However, Fit app shows both as "walking", so it apparently uses a different data source. I checked some other days and on these days, the session with type 0 is indeed a valid "in vehicle" session. I tried all aggregated data sources