java,android,android-studio,google-play-services,google-fit
The API has changed slightly since that video was released. See the SensorApi documentation for more details. The DataSourceListener has been replaced by the OnDataPointListener which is used in a call to SensorApi.add(GoogleApiClient, SensorRequest, OnDataPointListener).
It turns out that the answer is in the docs after all. Here is the format of the request. GET https://www.googleapis.com/fitness/v1/users/{userId}/dataSources/{dataSourceId}/datasets/{datasetId} The only supported {userId} value is me (with authentication). Possible values for {dataSourceId} are avaiable by running a different request. The bit I missed was that {datasetId} is not...
android,android-wear,android-sensors,google-fit,google-fit-sdk
I have not tried any of this. It seems as though the Samsung Gear Live Sensors are not supported out of the box, but you might be able to make it work via software sensors: Your Gear Live As said in this SO answer, The Samsung Gear Live watch does...
android,authentication,google-plus,google-api-client,google-fit
I ended up solving my problems by using different callback and connectionFailed listeners for each one of the clients. My builder for the GoogleFitClient ended up looking like this: public void startFitnessClient() { mGoogleFitClient = new GoogleApiClient.Builder(this) .addApi(Fitness.API) .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE)) .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected(Bundle bundle) { if...
android,google-play-services,google-fit
You don't need to pay the registration fee unless you actually plan to publish your app in the play store. Just actually follow the steps as described in the guide that you linked to... It tells you how to obtain the fingerprint of the debug key using keytool. Follow the...
android,android-wear,voice-recognition,google-now,google-fit
the documentation also states those are "Example Phrases". The reason for that it's because such a list does not exist. Voice commands on those type of platforms (Google Now, Siri) use quite more advanced algorithms to recognize what a person wants, and not just recognize the actual words. That is...
android,gps,accelerometer,android-sensors,google-fit
Thanks for asking this question! Battery is one of our top most concerns and we work hard to optimize Google Fit's battery usage and provide a magical experience. Google Fit uses a mix of sensors(Accelerometer, Step counter, Significant Motion counter), Machine Learning and heuristics to get the data right. Our...
There is provision for custom data types so you could undoubtedly store the data. If it's a good idea is a different issue. You need to outline what your trying to achieve in a bit more detail. What sensor data are you talking about and what processing do you want...
Finally I have solved this issue by replacing ".setDataType(DataType.TYPE_ACTIVITY_SEGMENT)" with ".setDataType(DataType.TYPE_SPEED)" and I had to add a new permission: "addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))"
I figured out what I did wrong. Aggregate data is returned in Buckets, not DataSets, so instead of calling result.getDataSets(DataType.TYPE_STEP_COUNT_DELTA); , I have to do List<Buckets> buckets = result.getBuckets(), then iterate through the buckets and get data sets using buckets.get(currentIndex).getDataSet(DataType.AGGREGATE_STEP_COUNT_DELTA); ...
My solution is: $StartTime*1000000000; And convert in string using this function: http://php.net/manual/es/function.floatval.php#106367...
google-api-php-client,google-fit
I think the difference you are seeing is the difference between how Google uses the History API and the Sensors API. If you are using PHP, you are querying the Google Fit Store via the available fitness API and this is then dependant on what the App has had the...
The best way is to run Google Fit in a service. I have a scaffold project here that shows how that works. https://github.com/rsteckler/Android-Google-Fit-Service-Skeleton...
android-intent,android-fragments,bundle,google-fit
I solved this by using a Subclass application, thanks to this post : Pass connection object to other activity - Google Tasks API
It turns out there is something in google fit doc after all. Create your banana: DataSource nutritionSource = new DataSource.Builder() .setDataType(TYPE_NUTRITION) ... .build(); DataPoint banana = DataPoint.create(nutritionSource); banana.setTimestamp(now.getMillis(), MILLISECONDS); banana.getValue(FIELD_FOOD_ITEM).setString("banana"); banana.getValue(FIELD_MEAL_TYPE).setInt(MEAL_TYPE_SNACK); banana.getValue(FIELD_NUTRIENTS).setKeyValue(NUTRIENT_TOTAL_FAT, 0.4f); banana.getValue(FIELD_NUTRIENTS).setKeyValue(NUTRIENT_SODIUM, 1f);...
For anyone else that gets frustrated over this :) mYApp myApp = (mYApp) ctx; mGoogleApiClient = myApp.getMyUser(); mGoogleApiClient.reconnect(); Calendar cal = Calendar.getInstance(); Date now = new Date(); cal.setTime(now); long endTime = cal.getTimeInMillis(); cal.add(Calendar.HOUR_OF_DAY, -12); long startTime = cal.getTimeInMillis(); PendingResult<DataReadResult> pendingResult = Fitness.HistoryApi.readData(mGoogleApiClient, new DataReadRequest.Builder() .aggregate(DataType.TYPE_STEP_COUNT_DELTA,...
android,custom-data-type,google-fit,google-fit-sdk
The readDataType method will only return a dataType by name. docs Once it does you have to set a dataType variable to the results for use. DataType dataTypeFromResult = dataTypeRes.getDataType(); Then pass it to what you need. DataReadRequest readRequest = new DataReadRequest.Builder() .read(dataTypeFromResult) .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS) .build(); ...
If you are tracking the step counts in the foreground then this is correct behaviour as you are disconnecting the google api client in onstop(). Once GoogleApiClient is disconnected all the listeners will be removed from the GoogleApiClient. But if you wish to track the step counts in the background,...