Getting a list of actions (movements) from google fit api

I am creating an application that can use google fit api. I want all actions (Movements) to be available on Google. Here is a list of actions in the google fit Reference .

Edited

I know how to get actions that are performed by the user. But I want the full list of actions available in the google API (not only the activity performed by the user, I need the whole list of actions), as the list is available in the above link.

+4
source share
3 answers

Google Fit actions are listed in the FitnessActivities class .

, :

FitnessActivities.class.getFields()
+2

Google Fit API Android.

, API - Google Fit.

- https://developers.google.com/fit/android/get-started

, , :

https://developers.google.com/fit/android/data-types

, Google Fit Android-. , Google Fit.

EDIT:

, - . , , , Google Fit Andorid. , , , .

"" (, STILL, RUNNING, WALKING) Google Fit:

        DataReadRequest readRequest = new DataReadRequest.Builder()
            .read(DataType.TYPE_ACTIVITY_SEGMENT)
            // maybe you want to limit data to specific time range?
            //.setTimeRange(today.startTime, today.endTime, TimeUnit.MILLISECONDS)
            .build();

. :

        Fitness.HistoryApi.readData(mClient, readRequest).setResultCallback(new ResultCallback<DataReadResult>() {
        @Override
        public void onResult(DataReadResult dataReadResult) {
            for (DataSet dataSet : dataReadResult.getDataSets()) {
                for (DataPoint dataPoint : dataSet.getDataPoints()) {
                    DataType dataType = dataPoint.getDataType();
                    if (dataType.equals(DataType.TYPE_ACTIVITY_SEGMENT)) {
                        String activity = FitnessActivities.getValue(dataPoint);

                        /* process as needed */
                        /* the `activitity' string contains values as described here:
                         * https://developer.android.com/reference/com/google/android/gms/fitness/FitnessActivities.html
                         */

                    }
                }
            }
        }
    });

, - ( , .. , ..), Google Fit Android.

+1

Hope this can help others ...

List<Session> sessions = sessionReadResponse.getSessions();

for (Session session : sessions) {
    dumpSession(session);
    Log.i(TAG, "Activity Name: "+sessions.get(position).getActivity());
    position++;
    List<DataSet> dataSets = sessionReadResponse.getDataSet(session);
    for (DataSet dataSet : dataSets) {
        dumpDataSet(dataSet);
    }
}
0
source

All Articles