Google fit что это


Что такое Google Fit и как с ним жить?

Чего только не умеют делать мобильные девайсы и носимые гаджеты! Они оповещают нас о прогнозе погоды и помогают не попасть в пробку на оживленной магистрали, дают возможность выбрать подходящий ресторан и определить кратчайший путь из точки А в точку В. Так почему бы не наделить их дополнительными способностями? Например, чтобы они помогали следить за физической активностью, подсчитывали количество пройденных шагов и сожженных калорий? 

Благодаря сервису Google Fit ты можешь превратить в фитнес-трекер любое устройство на Android. 

Да, фитнес-трекеры, спортивные браслеты, некоторые «умные» часы, электронные шагомеры умеют это делать. Но Google пошел дальше! Благодаря сервису Google Fit ты можешь превратить в фитнес-трекер любое устройство на Android. 

Что для этого нужно? 

Во-первых, тебе потребуется скачать приложение Google Fit и установить его на девайс, которым ты пользуешься. Есть версии для обычного Android, а также для Android Wear. 

Предусмотрены версии Google Fit для обычного Android, а также для Android Wear. 

Во-вторых, необходимо, чтобы у тебя был аккаунт Google. В нем нужно будет заполнить профиль – указать пол, рост и вес. Не льсти себе, указывай данные с максимальной точностью, ведь сервис использует их при расчетах. Введешь неправду – на выходе тоже получишь не вполне верную информацию. Также здесь можно задать цели физической активности. Сейчас поддерживаются следующие варианты: 

• количество пройденных шагов; 

• время, потраченное на физическую активность; 

• расстояние, которое ты пройдешь, пробежишь или проедешь на велосипеде; 

• сожженные калории. 

Цвет отрезков кольца в приложении Google Fit зависит от твоего способа передвижения.

Как это работает? 

Ты носишь с собой девайс, а Google Fit отслеживает его перемещение. 

Что особенно приятно – не нужно никаких дополнительных настроек. Сделай все, что перечислено выше, а дальше Google Fit примется за работу. 

Прогресс выполнения поставленной цели визуализируется на экране мобильного девайса. Возьмем, к примеру, пройденное расстояние. На экране появляется кольцо, которое постепенно меняет цвет по мере того, как ты приближаешься к желаемому результату. Цвет отрезков кольца зависит от способа передвижения: 

• оранжевый – ходьба; 

• бордовый – бег; 

• бирюзовый – езда на велосипеде. 

Google Fit умеет строить графики активности за заданный промежуток времени. 

Разницу между способами передвижения Google Fit определяет автоматически, система ориентируется в первую очередь на скорость, с которой ты движешься, поэтому возможны забавные казусы: так, быструю ходьбу он может зачесть за бег, а быстрый бег – за езду на велосипеде. Человек с фантазией может предположить, что ускоренное кручение педалей велосипеда могло бы заставить сервис задуматься, не едешь ли ты на самом деле на машине. Впрочем, в будущем создатели Google Fit обещают сделать работу своего детища более точной, чтобы оно не путало бег с ходьбой. 

Когда цель достигнута, на экране появится надпись «Вы это сделали!». Также можно посмотреть, на сколько шагов или метров была превышена норма – или наоборот, сколько тебе не хватило до достижения желаемой цели. 

Еще больше статистики 

Можно познакомиться и с более подробной статистикой: так, Google Fit готов рассказать тебе о каждом отрезке твоей активности – сколько шагов было сделано и какое расстояние ты преодолел (пешком или на велосипеде). 

Благодаря Google Fit следить за своей физической активностью можно буквального с любого устройства на Android. 

Google Fit умеет строить как дневные графики, так и графики активности за заданный промежуток времени. Причем можно выбрать любую точку на графике или диаграмме, чтобы посмотреть, что ты делал в тот день – это поможет тебе понять, почему в одном случае тебе удалось достичь поставленной цели, а в другом – нет. 

В описании сервиса заявлено, что Google Fit совместим со спортивными приложениями от Nike, HTC, LG, RunKeeper, Withings, Motorola, Noom, Runtastic и Polar, но это задел на будущее. В реальности совместимости с некоторыми приложениями еще нет, что касается тех, которыми можно пользоваться, точность нередко страдает. Так что возможность собрать как можно больше информации о своей физической активности есть, но только в перспективе. 

Работает всегда! 

Сервис хорош тем, что его не нужно включать, как многие спортивные приложения. Ты просто устанавливаешь приложение, заполняешь профиль – а дальше Google Fit работает, работает и работает. Ты можешь на какое-то время забыть о нем, а затем вновь вернуться к просмотру информации о своей активности, и окажется, что сервис запомнил все, что нужно. 

Ты просто устанавливаешь приложение, заполняешь профиль – а дальше Google Fit работает, работает и работает.

Если же ты считаешь, что данная функция больше не нужна, она легко отключается в настройках девайса. 

Еще не время выбрасывать фитнес-трекер 

Ну что, пора выбрасывать фитнес-трекер? На самом деле, конечно, нет. Google Fit пока что предлагает лишь базовые возможности, даже не все заявленные функции работают так хорошо, как хотелось бы. «Изюминка» сервиса в том, что с его помощью можно следить за своей физической активностью с помощью буквального любого устройства на Android. 

Но если ты серьезно занимаешься спортом или фитнесом, имеет смысл пользоваться более «продвинутыми» девайсами и гаджетами, у которых больше возможностей, которые обеспечивают более высокую точность, которые обладают функцией тренера – то есть, могут давать советы и рекомендации. 

Ну а когда Google Fit хорошенько разовьется – тогда и посмотрим, что лучше.

www.svyaznoy.ru

Fitness Data Types  |  Google Fit  |  Google Developers

Google Fit provides a set of fitness data types under the com.google namespace. Data types define the format of the values inside data points. A data point can represent:

  • An instantaneous reading or observation
  • An aggregate with statistics over a time interval

Google Fit defines data types for instantaneous observations and data types for aggregate data. Data points consist of values for the fields of a data type and timestamp information. Points that represent instantaneous observations include a timestamp, and points of an aggregate data type also include a timestamp for the start of the interval.

Google Fit enables you to define new data types in your app and to share your new data types with other apps.

For more information about inserting data points, see Add points to a dataset.

Data types

There are three kinds of data types in Google Fit:

Public data types

Standard data types provided by the platform, like com.google.step_count.delta. Any app can read and write data of these types.For more information, see Public Data Types.

Private custom data types

Custom data types defined by a specific app. Only the app that defines the data type can read and write data of this type.For more information, see Custom Data Types.

Shareable data types

Custom data types submitted to the platform by an app developer. Once approved, any app can read data of a shareable type, but only whitelisted apps as specified by the developer can write data of that shareable type.For more information, see Shareable Data Types.

Public data types

Google Fit defines public data types for instantaneous readings and data types for aggregate data.

Data types for instantaneous readings

The following table lists data types for instantaneous readings:

Data Type Name Description Permission Fields (Format—Unit)
com.google.activity.sample Instantaneous sample of the current activity. Activity activity (int—enum)confidence (float—percent)
com.google.activity.segment Continuous time interval of a single activity. Activity activity (int—enum)
(deprecated) com.google.calories.consumed Total calories consumed over a time interval. Activity calories (float—kcal)
com.google.calories.expended Total calories expended over a time interval. Activity calories (float—kcal)
com.google.cycling.pedaling.cadence Instantaneous pedaling rate in crank revolutions per minute. Activity rpm (float—rpm)
com.google.cycling.wheel_revolution.rpm Instantaneous wheel speed. Location rpm (float—rpm)
com.google.distance.delta Distance covered since the last reading. Location distance (float—meters)
com.google.heart_rate.bpm Heart rate in beats per minute. Body bpm (float—bpm)
com.google.height The user's height, in meters. Body height (float—meters)
com.google.location.sample The user's current location. Location latitude (float—degrees)longitude (float—degrees)accuracy (float—meters)altitude (float—meters)
com.google.nutrition Food item information Nutrition nutrients (Map<String, float>—calories/grams/IU) meal_type (int—enum)food_item (String—n/a)
com.google.power.sample Instantaneous power generated while performing an activity. Activity watts (float—watts)
com.google.speed Instantaneous speed over ground. Location speed (float—m/s)
com.google.step_count.cadence Instantaneous cadence in steps per minute. Activity rpm (float—steps/min)
com.google.step_count.delta Number of new steps since the last reading. Activity steps (int—count)
com.google.weight The user's weight. Body weight (float—kg)
com.google.activity.exercise A user's continuous workout routine. Activity exercise (int—enum)repetitions (int—count)resistance type (int—enum)resistance (float—kg)duration (int—milliseconds)

Data types for aggregate data

The following table lists data types for aggregate data:

Data Type Name Description Permission Fields (Format—Unit)
com.google.activity.summary Total time and number of segments in a particular activity for a time interval. Activity activity (int—enum)duration (int—ms)num_segments (int—count)
com.google.heart_rate.summary Average, maximum, and minimum beats per minute for a time interval. Body average (float—bpm)max (float—bpm)min (float—bpm)
com.google.location.bounding_box A bounding box for the user's location over a time interval. Location low_latitude (float—degrees)low_longitude (float—degrees)high_latitude (float—degrees)high_longitude (float—degrees)
com.google.nutrition.summary User's nutrition intake during a time interval. Nutrition nutrients (Map<String, float>—calories/grams/IU)meal_type (int—enum)food_item (String—n/a)
com.google.power.summary Average, maximum, and minimum power generated while performing an activity. Activity average (float—watts)max (float—watts)min (float—watts)
com.google.speed.summary Average, maximum, and minimum speed over ground over a time interval. Location average (float—m/s)max (float—m/s)min (float—m/s)
com.google.weight.summary Average, maximum, and minimum weight over a time interval. Body average (float—kg)max (float—kg)min (float—kg)

Using data types with the REST API

The dataSources resource includes the data type (and a list of its fields) for each data source. You can specify one of these data types when you create data sources, and you can obtain the name of the data type and a list of its fields when you retrieve a data source from the fitness store.

For example, a data source representation specifies its data type as follows:

{ "dataStreamId": "exampleDataSourceId", ... "dataType": { "field": [ { "name": "steps", "format": "integer" } ], "name": "com.google.step_count.delta" }, ... }

When using one of the public data types in a data source, the data type name and its field definitions must match those listed in the tables above.

Custom data types

Google Fit enables you to create custom data types for your application and to use them to store fitness data. When you create custom data types, ensure that:

  • Google Fit does not already provide a similar data type.
  • The data type name is clear.
  • The data type name accurately represents the underlying data.
  • The prefix of the data type name matches the package name of your application.
Note: Custom data types are not available to use in other applications. Only the application that creates a custom fitness data type can use it. To create a custom data type and share it with other applications, see Shareable Data Types.

Create a custom data type

To create a custom data type, create a new data source specifying the name of the data type and its field definitions.

For example, define a custom data type in a data source as follows:

{ "dataStreamId": "exampleDataSourceId", ... "dataType": { "field": [ { "name": "myFieldA", "format": "integer" }, { "name": "myFieldB", "format": "integer" }, ], "name": "com.example.myapp.mycustomtype" }, ... }

Use a custom data type

To insert fitness data of your custom type, specify the data source you created for your data type when you create a dataset with new data points. The data points must have the same number of components and types as those specified by your custom data type.

To read fitness data of your custom data type, specify the data source you created for your data type when you retrieve data points from the fitness store.

Shareable data types

Shareable data types are custom data types that have been approved by Google to be shared on Google Fit. You can submit a request to create a new shareable data type, and applications can use existing shareable data types in accordance with the terms and conditions set by the developer who created the data type.

Guidelines for new shareable data types

In addition to the guidelines for custom data types, ensure that your proposed shareable data type:

  • Does not duplicate an existing public data type.
  • Uses standard units when possible.
  • Represents fitness-related data.
  • Represents data that is relevant to other fitness apps.
Note: Any application can read fitness data of a shareable data type, if the user grants it permission. Only applications approved by the developer of a shareable data type can write data of this type, if the user grants them permission.

Request a new shareable data type

To request a new shareable data type:

  1. Send an email to [email protected] with a request to add a new shareable data type to Google Fit. Provide a brief description of your data type and explain why this data type might be useful to users and developers.

  2. If your proposed data type adheres to the Google Fit developer terms, follows the guidelines above, and has a compelling developer use case, we will send you a form to fill out.

  3. After you receive the form, provide the following data:

    Form Item Description
    Data type name

    Your data type name should accurately represent the underlying data. For example, one of the Google data types is com.google.location.sample, which represents a latitude-longitude location sample.

    The prefix of your data type name should not be tied to your application's package name, so developers can read this data type even if your application is not installed on the device.

    Use lowercase words to name your data type.

    Example of a good name: com.mycompanyname.mydatatypename

    Data type description

    Explain the following:

    • What the data type is
    • Roughly how it is calculated
    • Which of your devices and/or apps can provide data of this type
    • How can users and developers use data of this type
    Data type fields

    Provide the following:

    • Field names
    • Field types (only int and float are currently supported)
    • Field units (degrees, beats per minute, calories, and so on)

    For example, com.google.location.sample has these fields:

    • latitude (float – degrees)
    • longitude (float – degrees)
    Whitelisted accounts A list of Google Accounts to whitelist for access to these data types during development and testing.
    Apps that can write data A list of app package names that can write data of this type.
  4. Once we review your responses, you may get questions from our team before approval.

    For a shareable developer data type to be approved, the data type must:

    • Follow the guidelines listed above.
    • Be consistent with Google policies.
    • Have its format reviewed and approved by the Google Fit engineering team to ensure good design. The data type:
      • should not be ambiguous
      • should use standard units as much as possible
      • should include only fitness-related data
      • shouldn't be too broad (as close to raw data as possible)
    • Have its usefulness reviewed by the Google Fit product team. The data type:
      • should not be too specific or only enable one-to-one interactions
      • must enable making data accessible and useful by any app
  5. Your approved shareable data type will be launched within a mutually-agreed timeframe, and it will be listed in the Available Shareable Data Types section.

Available shareable data types

For more information about these shareable data types, see the third party developer terms and documentation for each data type.

Data Type Name Third Party Description Permission Fields(Format—Unit) Third Party Documentation
com.nike.NIKEFUEL Nike NikeFuel is a universal metric for movement that allows athletes to measure and compare all day activity and training intensity, and get real time feedback for any sport, at any skill level. Activity NIKEFUEL(int—NikeFuel points) Terms of Use
com.adidas.jump.height Adidas Jump height measures the height in inches for each jump recorded over a given period of time. Activity height(float—inches) Terms of Use
com.adidas.hustle Adidas Hustle measures how much force (effort) one generates through events (sprints, cuts and jumps) over a given period of time. Activity hustle(float—m/s2/min) Terms of Use
com.adidas.quickness Adidas Quickness is determined by how quick (on average) one changes their upper body linear speed or direction. Activity quickness(float—m/s2/sec) Terms of Use
Note: This table will be updated with new shareable data types as they become available.

Inserting data of a shareable type

Only applications approved by the developer of a shareable data type can write data of this type.

To insert data of a shareable type using the REST API, create a data source that specifies the shareable data type (including its fields and types) as the datasource's data type. Then use that data source to insert fitness data.

Reading data of a shareable type

To read data of a shareable type, look for available data sources whose data type is the shareable data type you're interested in.

developers.google.com

Activity Types  |  Google Fit  |  Google Developers

Google Fit defines integer constant values for a set of activity types. Use these values for consistency across apps when you insert data points of these types:

  • com.google.activity.sample
  • com.google.activity.segment
  • com.google.activity.summary

These constants define the activity type in the activity field of the data points.

Activity type values

The following tables list the constant values for each activity type.

Activity Type Integer Value
Aerobics 9
Archery 119
Badminton 10
Baseball 11
Basketball 12
Biathlon 13
Biking* 1
Handbiking 14
Mountain biking 15
Road biking 16
Spinning 17
Stationary biking 18
Utility biking 19
Boxing 20
Calisthenics 21
Circuit training 22
Cricket 23
Crossfit 113
Curling 106
Dancing 24
Diving 102
Elevator 117
Elliptical 25
Ergometer 103
Escalator 118
Fencing 26
Football (American) 27
Football (Australian) 28
Football (Soccer) 29
Frisbee 30
Gardening 31
Golf 32
Gymnastics 33
Handball 34
HIIT 114
Hiking 35
Hockey 36
Horseback riding 37
Housework 38
Ice skating 104
In vehicle* 0
Interval Training 115
Jumping rope 39
Kayaking 40
Kettlebell training 41
Kickboxing 42
Kitesurfing 43
Martial arts 44
Meditation 45
Mixed martial arts 46
On foot* 2
Other (unclassified fitness activity) 108
P90X exercises 47
Paragliding 48
Pilates 49
Polo 50
Racquetball 51
Rock climbing 52
Rowing 53
Rowing machine 54
Rugby 55
Activity Type (continued) Integer Value
Running* 8
Jogging 56
Running on sand 57
Running (treadmill) 58
Sailing 59
Scuba diving 60
Skateboarding 61
Skating 62
Cross skating 63
Indoor skating 105
Inline skating (rollerblading) 64
Skiing 65
Back-country skiing 66
Cross-country skiing 67
Downhill skiing 68
Kite skiing 69
Roller skiing 70
Sledding 71
Sleeping 72
Light sleep 109
Deep sleep 110
REM sleep 111
Awake (during sleep cycle) 112
Snowboarding 73
Snowmobile 74
Snowshoeing 75
Softball 120
Squash 76
Stair climbing 77
Stair-climbing machine 78
Stand-up paddleboarding 79
Still (not moving)* 3
Strength training 80
Surfing 81
Swimming 82
Swimming (open water) 84
Swimming (swimming pool) 83
Table tennis (ping pong) 85
Team sports 86
Tennis 87
Tilting (sudden device gravity change)* 5
Treadmill (walking or running) 88
Unknown (unable to detect activity)* 4
Volleyball 89
Volleyball (beach) 90
Volleyball (indoor) 91
Wakeboarding 92
Walking* 7
Walking (fitness) 93
Nording walking 94
Walking (treadmill) 95
Walking (stroller) 116
Waterpolo 96
Weightlifting 97
Wheelchair 98
Windsurfing 99
Yoga 100
Zumba 101

* Recorded passively by the device using the DetectedActivity class.

developers.google.com

Authorization on Android  |  Google Fit  |  Google Developers

User consent is always required before your app can read or write fitness data. To obtain authorization:

  • Register your Android app with a project in the Google Developers Console.
  • Specify a scope of access when connecting to the fitness service.

In Google Fit, scopes are strings that determine what kinds of fitness data an app can access and the level of access to this data.

Figure 1: The consent screen.

Authorization flow

The authorization flow is the following:

  1. Your app requests a connection, with one or more scopes of access, to the fitness service.
  2. Google Fit prompts the user to grant your app the required permissions.
  3. If the user consents, your app can access fitness data of the types defined by the scope.

The specific permissions requested from the user depend on the scopes that your app specifies when connecting to the service.

Fitness scopes

The scopes for Google Fit on Android are defined as public fields of the Scopes class. Their field names start with the FITNESS_ prefix. Each scope provides access to a set of fitness data types. Some scopes provide read-only access to fitness data, but other scopes provide read and write access to fitness data. The scopes are listed in table 1.

Note: Ensure that your app requests only the scopes that it needs, so users are more likely to grant your app the required permissions.

For an example on how to request particular scopes when connecting to the service, see Getting Started. For more information about data types, see Fitness Data Types.

Table 1: Scopes for Google Fit

Permission Scope Type of Access Data Types
Activity FITNESS_ACTIVITY_READ Read com.google.activity.samplecom.google.activity.segmentcom.google.activity.summary(deprecated) com.google.calories.consumedcom.google.calories.expendedcom.google.cycling.pedaling.cadencecom.google.power.samplecom.google.step_count.cadencecom.google.step_count.deltacom.google.activity.exercise
FITNESS_ACTIVITY_READ_WRITE Read and Write
Body FITNESS_BODY_READ Read com.google.heart_rate.bpmcom.google.heart_rate.summarycom.google.heightcom.google.weightcom.google.weight.summary
FITNESS_BODY_READ_WRITE Read and Write
Location FITNESS_LOCATION_READ Read com.google.cycling.wheel_revolution.cumulativecom.google.cycling.wheel.revolutionscom.google.distance.deltacom.google.location.samplecom.google.location.bounding_boxcom.google.speedcom.google.speed.summary
FITNESS_LOCATION_READ_WRITE Read and Write
Nutrition FITNESS_NUTRITION_READ Read com.google.nutrition.itemcom.google.nutrition.summary
FITNESS_NUTRITION_READ_WRITE Read and Write

Scopes for Google Fit with Android 6.0 Marshmallow

Android 6.0 changes the permissions model to provide increased visibility and control over individual permissions. On previous versions of Android, Google Fit uses OAuth permissions to allow apps to read location and sensor data from Google Fit, but permissions on Android 6.0 are managed at a more granular level.

Apps built with Google Fit use the ACCESS_FINE_LOCATION and BODY_SENSORS permissions. Apps that access one of the data types listed in the following table need to specify the required permissions in your app's AndroidManifest.xml:

Table 2: Scopes for Google Fit with Android 6.0 Marshmallow

Apps built with various versions of the Google Play services client library behave as follows:

  • If the Google Play services client library version is greater than 8.1, the app throws a security exception if a required runtime permission is missing from AndroidManifest.xml.
  • If the Google Play services client library version is less than or equal to 8.1, your app continues to behave as it has, but Google recommends updating AndroidManifest.xml so that users are aware of the data used by your app.

Devices running an Android version less than 6.0 silently fail if a required permission is not requested in the AndroidManifest.xml file, regardless of whether your app targets Android API level 23 or not.

developers.google.com


Смотрите также