{"id":252375,"date":"2015-03-04T10:51:05","date_gmt":"2015-03-04T06:51:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=252375"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=252375","title":{"rendered":"GoogleFit API \u2014 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u043c \u0438 \u0432\u0438\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442"},"content":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440! \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0433\u0430\u0434\u0436\u0435\u0442\u044b \u0438 \u043d\u043e\u0441\u0438\u043c\u0430\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u0438\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043e\u0442\u043a\u0443\u0434\u0430 \u0434\u0443\u0448\u0435 \u0443\u0433\u043e\u0434\u043d\u043e, \u0448\u0430\u0440\u0438\u0442\u044c \u0438 \u043b\u0430\u0439\u043a\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u043d\u043e \u0438 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435\u043c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043f\u043e\u0440\u0442\u0438\u0432\u043d\u044b\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0441\u0442\u0438 \u0437\u0434\u043e\u0440\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0436\u0438\u0437\u043d\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ac\/31c\/b84\/7ac31cb84d65ccb2781a2e928e80b06d.png\"\/><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u0440\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 GoogleFit API \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 Android \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435: \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 \u043e\u0431\u043b\u0430\u043a\u043e \u0438 \u0432\u044b\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u0415\u0449\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438, \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u0449\u0438\u0435 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f GoogleFit API \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u0445. <\/p>\n<p>  <i>\u0421\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"http:\/\/habrahabr.ru\/users\/constantinemars\/\" class=\"user_link\">ConstantineMars<\/a> \u0437\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/i><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u0427\u0442\u043e \u043a \u0447\u0435\u043c\u0443<\/h1>\n<p>  <b>GoogleFit<\/b> \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043f\u043e\u0440\u0442\u0430\u043b\u0435 Google Developers, \u0442\u0430\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0441 Fit \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d \u0446\u0435\u043b\u044b\u0439 <a href=\"https:\/\/developers.google.com\/fit\/android\/\">\u0440\u0430\u0437\u0434\u0435\u043b<\/a>. \u0414\u043b\u044f \u0442\u0435\u0445 \u0436\u0435, \u043a\u043e\u043c\u0443 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441 \u0433\u043e\u043b\u043e\u0432\u043e\u0439 \u043d\u044b\u0440\u044f\u0442\u044c \u0432 \u043e\u043f\u0438c\u0430\u043d\u0438\u044f API, \u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442 \u0432\u0438\u0434\u0435\u043e Lisa Wray, \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e Google Developer Advocate. <\/p>\n<p>  \u041d\u0430\u0447\u0430\u0442\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 Fit \u043c\u043e\u0436\u043d\u043e \u0441 \u044d\u0442\u043e\u0433\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430:<br \/>   <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/jwaQaWGLlTo?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>  GoogleFit \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0444\u0438\u0442\u043d\u0435\u0441-\u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 (\u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\u0445, \u0443\u043c\u043d\u044b\u0445 \u0447\u0430\u0441\u0430\u0445, \u0444\u0438\u0442\u043d\u0435\u0441-\u0431\u0440\u0430\u0441\u043b\u0435\u0442\u0430\u0445), \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u00ab\u0444\u0438\u0442\u043d\u0435\u0441-\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439\u00bb \u0438\u043b\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u0435\u0441\u0441\u0438\u0439\/\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a. <\/p>\n<p>  \u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 API \u043f\u043e\u0434 Android, \u0438 REST API \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0435\u0431-\u043a\u043b\u0438\u0435\u043d\u0442\u0430. <\/p>\n<p>  \u0412\u0430\u0436\u043d\u0435\u0439\u0448\u0443\u044e \u0440\u043e\u043b\u044c \u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 GoogleFit \u0438\u0433\u0440\u0430\u044e\u0442 \u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0433\u0430\u0434\u0436\u0435\u0442\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0441\u0442\u0430\u0432\u043a\u0438. \u041a\u0440\u043e\u043c\u0435 \u00ab\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445\u00bb \u0443\u043c\u043d\u044b\u0445 \u0447\u0430\u0441\u043e\u0432, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0444\u0438\u0442\u043d\u0435\u0441-\u0431\u0440\u0430\u0441\u043b\u0435\u0442\u043e\u0432 Nike+ \u0438 Jawbone Up \u0438\u043b\u0438 Bluetooth \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432. \u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443, \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/820\/25c\/a2e\/82025ca2e1949397cf77271b18abfbb7.png\"\/><\/p>\n<p>  Fit API \u2014 \u0447\u0430\u0441\u0442\u044c <b>Google Play Services<\/b>. \u041a\u0430\u043a \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0437\u043d\u0430\u044e\u0442, \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e OS Android \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u043a\u0430\u043a \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 Play Services. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u044b\u043d\u043e\u0441\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 API \u0432 \u0447\u0430\u0441\u0442\u044c, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u0443\u044e Google, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u043e\u0432, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043c\u0438\u0440\u0443 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, Fit API \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0441\u0435\u043c, \u0443 \u043a\u043e\u0433\u043e \u043d\u0430 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435 \u0441\u0442\u043e\u0438\u0442 Android \u0432\u0435\u0440\u0441\u0438\u0438 2.3 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435 (Gingerbread, API level 9).<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e \u043b\u0438\u0448\u043d\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f Fit API:   <\/p>\n<ul>\n<li><b>Data Sources<\/b> \u2014 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442. \u0435. \u0434\u0430\u0442\u0447\u0438\u043a\u0438. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438, \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c\u0438 (\u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0443\u0442\u0435\u043c \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432).  <\/li>\n<li><b>Data Types<\/b> \u2014 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445: \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432 \u0438\u043b\u0438 \u043f\u0443\u043b\u044c\u0441. \u0422\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u043c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, location {latitude, longitude, \u0438 accuracy}.  <\/li>\n<li><b>Data Points<\/b> \u2014 \u043e\u0442\u043c\u0435\u0442\u043a\u0438 \u0444\u0438\u0442\u043d\u0435\u0441-\u0437\u0430\u043c\u0435\u0440\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043c\u0435\u0440\u0430.  <\/li>\n<li><b>Datasets<\/b> \u2014 \u043d\u0430\u0431\u043e\u0440\u044b \u0442\u043e\u0447\u0435\u043a (data points), \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0434\u0430\u0442\u0447\u0438\u043a\u0443). \u041d\u0430\u0431\u043e\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.  <\/li>\n<li><b>Sessions<\/b> \u2014 \u0441\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u044e\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0437\u0430\u0431\u0435\u0433 \u0438\u043b\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430. \u0421\u0435\u0441\u0441\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 (Segment).  <\/li>\n<li><b>GATT (Generic Attribute Profile)<\/b> \u2014 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u043c\u0435\u043d <a href=\"https:\/\/developer.bluetooth.org\/TechnologyOverview\/Pages\/BLE.aspx\">\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 BLE \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438<\/a>.  <\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7b9\/7c5\/d29\/7b97c5d294054744419de7ebfe856aee.png\"\/><\/p>\n<p>  \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 Google Fitness API \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439:  <\/p>\n<ul>\n<li><b>Sensors API <\/b>\u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c (sensors) \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0436\u0438\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u0445.  <\/li>\n<li><b>Recording API <\/b> \u2014 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u00ab\u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a\u00bb.  <\/li>\n<li><b>History API<\/b> \u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Google Fit.  <\/li>\n<li><b>Sessions API<\/b> \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0444\u0438\u0442\u043d\u0435\u0441-\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0435\u0441\u0441\u0438\u0439 \u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432.  <\/li>\n<li><b>Bluetooth Low Energy API<\/b> \u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c Bluetooth Low Energy \u0432 GoogleFit. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e API \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 BLE \u0434\u0435\u0432\u0430\u0439\u0441\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0438\u0445 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u043a\u0435.  <\/li>\n<\/ul>\n<h1>GoogleFitResearch demo<\/h1>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 GoogleFit \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 API \u043d\u0435 \u0443\u0442\u0440\u0443\u0436\u0434\u0430\u044f \u0441\u0435\u0431\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0430\u0437\u0438\u0441\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 GoogleFit Research demo \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u0440\u0430\u0442\u044c \u043d\u0430 <a href=\"https:\/\/bitbucket.org\/c-mars\/googlefitresearch\">BitBucket<\/a>.<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e: \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432 \u0432\u0436\u0438\u0432\u0443\u044e, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e Sensors API. <\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e-\u043d\u0430\u043f\u0435\u0440\u0432\u043e \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u0441 \u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412 Sensors API \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0434\u0438\u043d, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043b\u0438 \u0445\u043e\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0438. <\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043f\u0443\u043b\u044c\u0441\u0430, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e, \u0445\u043e\u0442\u044f \u043c\u044b \u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0440\u0443, \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0435\u0433\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c: \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u0435\u043b\u044c \u043f\u0443\u043b\u044c\u0441\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0443\u043c\u043d\u044b\u0445 \u0447\u0430\u0441\u0430\u0445 \u0438 \u0444\u0438\u0442\u043d\u0435\u0441-\u0442\u0440\u0435\u043a\u0435\u0440\u0430\u0445, \u043d\u043e \u043d\u0435 \u0432 \u0441\u0430\u043c\u043e\u043c \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435, \u0443\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043d\u0438 \u0447\u0430\u0441\u043e\u0432, \u043d\u0438 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u0443\u043b\u044c\u0441\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u2014 \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u0445 \u0442\u043e\u0436\u0435 \u043d\u0435\u0442. \u0422\u0430\u043a \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u00ab\u043d\u0435\u0433\u0430\u0442\u0432\u043d\u044b\u0439 \u0442\u0435\u0441\u0442\u00bb, \u0442.\u0435. \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u043d\u0443\u043b\u0438, \u0430 \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u2014 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. <\/p>\n<h1>Up to all night to get started<\/h1>\n<p>  \u0412\u0441\u0451, \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u2014 \u0432\u0430\u0448 Google-\u0430\u043a\u043a\u0430\u0443\u043d\u0442. \u041d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u2014 GoogleFit API \u0443\u0436\u0435 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0441\u044f \u043e\u0431\u043e \u0432\u0441\u0435\u043c.<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043e\u0442 Google Developers, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/googlesamples\/android-fit\">GitHub<\/a>.<\/p>\n<h1>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h1>\n<p>  <\/p>\n<ol>\n<li>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u043e\u0439\u0442\u0438 \u0432 \u0441\u0432\u043e\u0439 Google-\u0430\u043a\u043a\u0430\u0443\u043d\u0442 (\u0435\u0441\u043b\u0438 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0443 \u0432\u0430\u0441 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0435\u0433\u043e \u043d\u0435\u0442, \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u043d\u0435\u0434\u043e\u0440\u0430\u0437\u0443\u043c\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0441\u044b\u043b\u043a\u0435: <a href=\"https:\/\/accounts.google.com\/SignUp\">https:\/\/accounts.google.com\/SignUp<\/a>);  <\/li>\n<li>\u0417\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u043b\u0438\u0441\u044c? \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 <a href=\"https:\/\/console.developers.google.com\/\">Google Developer Console<\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0433\u043e Fitness API;  <\/li>\n<\/ol>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/0fd\/a71\/43b\/0fda7143b1ffa9f2981f1636b307f6d9.png\"\/><\/p>\n<ol>\n<li>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c SHA1-\u043a\u043b\u044e\u0447 \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 keytool. \u041a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043f\u043e <a href=\"https:\/\/developers.google.com\/fit\/android\/get-started#step_3_enable_the_fitness_api\">Google Fit<\/a>. \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c Play Services \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438: \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b API, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u2014 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.  <\/li>\n<\/ol>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ab2\/478\/425\/ab24784255eff37f544db61865d6b80b.png\"\/><\/p>\n<ol>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 build.gradle \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 Play Services:  <\/li>\n<\/ol>\n<p>  <i>dependencies {<br \/>   compile &#8216;com.google.android.gms:play-services:6.5.+&#8217;<br \/>  }<br \/>  <\/i><\/p>\n<h1>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/h1>\n<p>  \u0421 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043a\u043e\u0434\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c\u0441\u044f \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <b>GoogleApiClient.<\/b> \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 <b>Fitness.API<\/b> \u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 (SCOPE_LOCATION_READ) \u0438 \u0437\u0430\u043f\u0438\u0441\u044c (SCOPE_BODY_READ_WRITE) \u0438 \u0437\u0430\u0434\u0430\u0435\u0442 Listener\u2019\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u0437 Fitness.API. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a Google Play Services \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">client = new GoogleApiClient.Builder(activity)                 .addApi(Fitness.API)                 .addScope(Fitness.SCOPE_LOCATION_READ)                 .addScope(Fitness.SCOPE_ACTIVITY_READ)                 .addScope(Fitness.SCOPE_BODY_READ_WRITE)                 .addConnectionCallbacks(                         new GoogleApiClient.ConnectionCallbacks() {                              @Override                             public void onConnected(Bundle bundle) {                                 display.show(&quot;Connected&quot;);                                 connection.onConnected();                             }                              @Override                             public void onConnectionSuspended(int i) {                                 display.show(&quot;Connection suspended&quot;);                                 if (i == GoogleApiClient.ConnectionCallbacks.CAUSE_NETWORK_LOST) {                                     display.show(&quot;Connection lost. Cause: Network Lost.&quot;);                                 } else if (i == GoogleApiClient.ConnectionCallbacks.CAUSE_SERVICE_DISCONNECTED) {                                     display.show(&quot;Connection lost. Reason: Service Disconnected&quot;);                                 }                             }                         }                 )                 .addOnConnectionFailedListener(                         new GoogleApiClient.OnConnectionFailedListener() {                             \/\/ Called whenever the API client fails to connect.                             @Override                             public void onConnectionFailed(ConnectionResult result) {                                 display.log(&quot;Connection failed. Cause: &quot; + result.toString());                                 if (!result.hasResolution()) {                                     GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), activity, 0).show();                                     return;                                 }                                  if (!authInProgress) {                                     try {                                         display.show(&quot;Attempting to resolve failed connection&quot;);                                         authInProgress = true;                                         result.startResolutionForResult(activity, REQUEST_OAUTH);                                     } catch (IntentSender.SendIntentException e) {                                         display.show(&quot;Exception while starting resolution activity: &quot; + e.getMessage());                                     }                                 }                             }                         }                 )                 .build();           \u0441lient.connect(); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <b>GoogleApiClient.ConnectionCallbacks<\/b> \u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e (onConnected) \u0438\u043b\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e (onConnectionSuspended) \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<br \/>  <b>GoogleApiClient.OnConnectionFailedListener<\/b> \u2014 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0430\u043c\u0443\u044e \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u2014 \u043e\u0448\u0438\u0431\u043a\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a GoogleFit API, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u0443 OAuth-\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (result.startResolutionForResult):<\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/222\/200\/05b\/22220005b5ee5c73ac67f2697095b2ec.png\"\/><\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u043d\u0430\u0447\u0430\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u043c startResolutionForResult, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 onActivityResult:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">@Override     public void onActivityResult(int requestCode, int resultCode, Intent data) {         if (requestCode == REQUEST_OAUTH) {             display.log(&quot;onActivityResult: REQUEST_OAUTH&quot;);             authInProgress = false;             if (resultCode == Activity.RESULT_OK) {                 \/\/ Make sure the app is not already connected or attempting to connect                 if (!client.isConnecting() && !client.isConnected()) {                     display.log(&quot;onActivityResult: client.connect()&quot;);                     client.connect();                 }             }         }     } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e authInProgress \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043e\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 ID \u0437\u0430\u043f\u0440\u043e\u0441\u0430 REQUEST_OAUTH. \u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u044b\u0437\u043e\u0432\u043e\u043c mClient.connect(). \u042d\u0442\u043e \u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0443\u0436\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0432 onCreate, \u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0441\u0430\u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h1>Sensors API<\/h1>\n<p>  <b>Sensors API<\/b> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0436\u0438\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044e.<\/p>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 API \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u0440\u0430\u043f\u043f\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u0437 MainActivity \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f SensorsAPI \u0432 onConnected() \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">display.show(&quot;client connected&quot;); \/\/                we can call specific api only after GoogleApiClient connection succeeded                         initSensors();                         display.show(&quot;list datasources&quot;);                         sensors.listDatasources(); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 \u0436\u0435 \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Sensors API:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">Fitness.SensorsApi.findDataSources(client, new DataSourcesRequest.Builder()                 .setDataTypes(                         DataType.TYPE_LOCATION_SAMPLE,                         DataType.TYPE_STEP_COUNT_DELTA,                         DataType.TYPE_DISTANCE_DELTA,                         DataType.TYPE_HEART_RATE_BPM )                 .setDataSourceTypes(DataSource.TYPE_RAW, DataSource.TYPE_DERIVED)                 .build())                 .setResultCallback(new ResultCallback&lt;DataSourcesResult&gt;() {                     @Override                     public void onResult(DataSourcesResult dataSourcesResult) {                          datasources.clear();                         for (DataSource dataSource : dataSourcesResult.getDataSources()) {                             Device device = dataSource.getDevice();                             String fields = dataSource.getDataType().getFields().toString();                             datasources.add(device.getManufacturer() + &quot; &quot; + device.getModel() + &quot; [&quot; + dataSource.getDataType().getName() + &quot; &quot; + fields + &quot;]&quot;);                              final DataType dataType = dataSource.getDataType();                             if (    dataType.equals(DataType.TYPE_LOCATION_SAMPLE) ||                                     dataType.equals(DataType.TYPE_STEP_COUNT_DELTA) ||                                     dataType.equals(DataType.TYPE_DISTANCE_DELTA) ||                                     dataType.equals(DataType.TYPE_HEART_RATE_BPM)) {                                  Fitness.SensorsApi.add(client,                                         new SensorRequest.Builder()                                                 .setDataSource(dataSource)                                                 .setDataType(dataSource.getDataType())                                                 .setSamplingRate(5, TimeUnit.SECONDS)                                                 .build(),                                         new OnDataPointListener() {                                             @Override                                             public void onDataPoint(DataPoint dataPoint) {                                                 String msg = &quot;onDataPoint: &quot;;                                                 for (Field field : dataPoint.getDataType().getFields()) {                                                     Value value = dataPoint.getValue(field);                                                     msg += &quot;onDataPoint: &quot; + field + &quot;=&quot; + value + &quot;, &quot;;                                                 }                                                 display.show(msg);                                             }                                         })                                         .setResultCallback(new ResultCallback&lt;Status&gt;() {                                             @Override                                             public void onResult(Status status) {                                                 if (status.isSuccess()) {                                                     display.show(&quot;Listener for &quot; + dataType.getName() + &quot; registered&quot;);                                                 } else {                                                     display.show(&quot;Failed to register listener for &quot; + dataType.getName());                                                 }                                             }                                         });                             }                         }                         datasourcesListener.onDatasourcesListed();                     }                 }); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <b>Fitness.SensorsApi.findDataSources<\/b> \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 Datasources).<\/p>\n<p>  <b>DataSourcesRequest <\/b>\u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0442\u0438\u043f\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <b>DataType.TYPE_STEP_COUNT_DELTA<\/b>.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c DataSourcesResult, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0431\u0440\u0435\u043d\u0434, \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u043b\u044f \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445):  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\"> for (DataSource dataSource : dataSourcesResult.getDataSources()) {                             Device device = dataSource.getDevice();                             String fields = dataSource.getDataType().getFields().toString();                             datasources.add(device.getManufacturer() + &quot; &quot; + device.getModel() + &quot; [&quot; + dataSource.getDataType().getName() + &quot; &quot; + fields + &quot;]&quot;); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/085\/ea1\/437\/085ea1437bff5511acc8aa1272e3f12a.png\"\/><\/p>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a, \u0441\u0443\u0436\u0430\u044f \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0437\u0430\u0441\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (SamplingRate):  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">Fitness.SensorsApi.add(client,                                         new SensorRequest.Builder()                                                 .setDataSource(dataSource)                                                 .setDataType(dataSource.getDataType())                                                 .setSamplingRate(5, TimeUnit.SECONDS)                                                 .build(),                                         new OnDataPointListener() { \u2026 } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  DataPoint \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435, \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0438\u0445 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u00ab\u043f\u043e\u043b\u044f\u00bb (fields), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">new OnDataPointListener() {                                             @Override                                             public void onDataPoint(DataPoint dataPoint) {                                                 String msg = &quot;onDataPoint: &quot;;                                                 for (Field field : dataPoint.getDataType().getFields()) {                                                     Value value = dataPoint.getValue(field);                                                     msg += &quot;onDataPoint: &quot; + field + &quot;=&quot; + value + &quot;, &quot;;                                                 }                                                 display.show(msg);                                             }                                         }) <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0448\u0430\u0433\u043e\u0432 (delta) \u0432\u044b\u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 (\u0432\u0435\u0440\u043d\u0435\u0435, \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u0430\u043a \u0448\u0430\u0433, \u0442.\u043a. \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043f\u043e\u0442\u0440\u044f\u0445\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 :-p ).<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ca\/dd9\/683\/7cadd968364ee484699a478a2fb14b1f.png\"\/><\/p>\n<h1>Recording API<\/h1>\n<p>  \u0417\u0430\u043f\u0438\u0441\u0438 \u043d\u0435 \u0434\u0430\u044e\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u043d\u043e \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 History API \u0432 \u0432\u0438\u0434\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Recording API, \u2014 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u0447\u0442\u043e\u0431\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0435\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430 \u043d\u0430\u0441, \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0438\u0445 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a):  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">Fitness.RecordingApi.subscribe(client, DataType.TYPE_STEP_COUNT_DELTA)                 .setResultCallback(new ResultCallback&lt;Status&gt;() {                     @Override                     public void onResult(Status status) {                         if (status.isSuccess()) {                             if (status.getStatusCode() == FitnessStatusCodes.SUCCESS_ALREADY_SUBSCRIBED) {                                 display.show(&quot;Existing subscription for activity detected.&quot;);                             } else {                                 display.show(&quot;Successfully subscribed!&quot;);                             }                         } else {                             display.show(&quot;There was a problem subscribing.&quot;);                         }                     }                 }); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 DataType.TYPE_STEP_COUNT_DELTA. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">Fitness.RecordingApi.listSubscriptions(client, DataType.TYPE_STEP_COUNT_DELTA).setResultCallback(new ResultCallback&lt;ListSubscriptionsResult&gt;() {                     @Override                     public void onResult(ListSubscriptionsResult listSubscriptionsResult) {                         for (Subscription sc : listSubscriptionsResult.getSubscriptions()) {                             DataType dt = sc.getDataType();                             display.show(&quot;found subscription for data type: &quot; + dt.getName());                         }                     }                 }); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043b\u043e\u0433\u0438 \u0432\u043a\u043b\u0430\u0434\u043a\u0438 Recordings \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad9\/31d\/5b9\/ad931d5b986752d0eb9b834f72da0165.png\"\/><\/p>\n<h1>History API<\/h1>\n<p>  History API \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0437 \u043e\u0431\u043b\u0430\u043a\u0430. \u0421\u044e\u0434\u0430 \u0432\u0445\u043e\u0434\u044f\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u043d\u0435\u0435 \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 Recording API \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0430\u043a\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043d\u0435 \u0436\u0438\u0432\u043e\u0439 \u043f\u043e\u0442\u043e\u043a), \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">DataReadRequest readRequest = new DataReadRequest.Builder()                 .aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)                 .bucketByTime(1, TimeUnit.DAYS)                 .setTimeRange(start, end, TimeUnit.MILLISECONDS)                 .build(); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (DataReadRequest) \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c TYPE_STEP_COUNT_DELTA \u0432 AGGREGATE_STEP_COUNT_DELTA, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432 \u0437\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438; \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (.bucketByTime), \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 (.setTimeRange).  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">Fitness.HistoryApi.readData(client, readRequest).setResultCallback(new ResultCallback&lt;DataReadResult&gt;() {             @Override             public void onResult(DataReadResult dataReadResult) {                 if (dataReadResult.getBuckets().size() &gt; 0) {                     display.show(&quot;DataSet.size(): &quot;                             + dataReadResult.getBuckets().size());                     for (Bucket bucket : dataReadResult.getBuckets()) {                         List&lt;DataSet&gt; dataSets = bucket.getDataSets();                         for (DataSet dataSet : dataSets) {                             display.show(&quot;dataSet.dataType: &quot; + dataSet.getDataType().getName());                              for (DataPoint dp : dataSet.getDataPoints()) {                                 describeDataPoint(dp, dateFormat);                             }                         }                     }                 } else if (dataReadResult.getDataSets().size() &gt; 0) {                     display.show(&quot;dataSet.size(): &quot; + dataReadResult.getDataSets().size());                     for (DataSet dataSet : dataReadResult.getDataSets()) {                         display.show(&quot;dataType: &quot; + dataSet.getDataType().getName());                          for (DataPoint dp : dataSet.getDataPoints()) {                             describeDataPoint(dp, dateFormat);                         }                     }                 }              }         }); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u0438\u0431\u043e buckets dataReadResult.getBuckets(), \u043b\u0438\u0431\u043e DataSets dataReadResult.getDataSets().<br \/>  \u0412 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, bucket \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f DataSets, \u0438 API \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0432\u044b\u0431\u043e\u0440: \u0435\u0441\u043b\u0438 buckets \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 API \u043d\u0435\u0442, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0435\u0439 DataSets \u0438\u0437 dataResult. <br \/>  \u0412\u044b\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 DataPoints \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">public void describeDataPoint(DataPoint dp, DateFormat dateFormat) {         String msg = &quot;dataPoint: &quot;                 + &quot;type: &quot; + dp.getDataType().getName() +&quot;\\n&quot;                 + &quot;, range: [&quot; + dateFormat.format(dp.getStartTime(TimeUnit.MILLISECONDS)) + &quot;-&quot; + dateFormat.format(dp.getEndTime(TimeUnit.MILLISECONDS)) + &quot;]\\n&quot;                 + &quot;, fields: [&quot;;          for(Field field : dp.getDataType().getFields()) {             msg += field.getName() + &quot;=&quot; + dp.getValue(field) + &quot; &quot;;         }          msg += &quot;]&quot;;         display.show(msg);     } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041d\u0430\u0448\u0438 \u043b\u043e\u0433\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0435\u0441\u0441\u0438\u0439, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 Recording, \u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u0431\u0440\u0430\u043b \u0434\u043b\u044f \u043d\u0430\u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 GoogleFit (\u043e\u043d \u0442\u043e\u0436\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 Recording API, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0447\u0435\u0433\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432 \u0438 \u0432\u0440\u0435\u043c\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u0434\u0435\u043d\u044c).<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d12\/13a\/9af\/d1213a9afdca07de086aca0584b6fbf7.png\"\/><\/p>\n<h1>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435?<\/h1>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 (Sensors API), \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 GoogleFit (Recording API) \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 (History API). \u042d\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0444\u0438\u0442\u043d\u0435\u0441-\u0442\u0440\u0435\u043a\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u0434\u0432\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 API, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 GoogleFit \u2014 Sessions \u0438 Bluetooth. \u041f\u0435\u0440\u0432\u044b\u0439 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u044b \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 <a href=\"https:\/\/developers.google.com\/fit\/android\/using-sessions\">\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0438\u0442\u043d\u0435\u0441-\u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/a>. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/developers.google.com\/fit\/android\/ble-sensors\">Bluetooth-\u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c<\/a>, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0441\u044f \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 \u0434\u043e\u0441\u044f\u0433\u0430\u0435\u043c\u043e\u0441\u0442\u0438, \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u043a \u043a\u0430\u0440\u0434\u0438\u043e\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u044b, \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0432 \u043e\u0431\u0443\u0432\u0438\/\u043e\u0434\u0435\u0436\u0434\u0435 \u0438 \u0442. \u043f. <\/p>\n<p>  \u0415\u0449\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0435 \u0441\u0435\u043d\u0441\u043e\u0440\u044b \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b, \u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e FitnessSensorService). \u042d\u0442\u0438 \u0444\u0438\u0447\u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u043b\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e) \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. <\/p>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u0442\u0435\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 GoogleFit API, \u0432\u0430\u043c \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c \u0438 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0435\u0449\u0435 \u0434\u0432\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430: \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432, \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0440\u0438\u0441\u0443\u0435\u0442 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 GoogleFit (\u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 <a href=\"https:\/\/bitbucket.org\/danielnadeau\/holographlibrary\/wiki\/Home\">Bitbucket<\/a>, \u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u2014 <a href=\"https:\/\/developer.android.com\/training\/building-wearables.html\">AndroidWear<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 API \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0443\u043b\u044c\u0441\u0430 \u0432 \u0443\u043c\u043d\u044b\u0445 \u0447\u0430\u0441\u0430\u0445<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/9f0\/70a\/042\/9f070a0425e4b2adda6c5e1b87081d93.png\"\/> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/4d8\/0f2\/9c5\/4d80f29c56d1f37ff6491668f3005a92.png\"\/> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/498\/755\/0f5\/4987550f5bd278e322df178615725dae.png\"\/><\/p>\n<p>  <b>\u0423\u0434\u0430\u0447\u0438 \u0432\u0430\u043c \u0438 \u0443\u0441\u043f\u0435\u0445\u043e\u0432 \u0432 \u0441\u043f\u043e\u0440\u0442\u0435!<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/bcf\/cf1\/781\/bcfcf1781c94a9561a2b90a32a4505fc.png\"\/>      \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/252083\/\"> http:\/\/habrahabr.ru\/post\/252083\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440! \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0433\u0430\u0434\u0436\u0435\u0442\u044b \u0438 \u043d\u043e\u0441\u0438\u043c\u0430\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u0438\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043e\u0442\u043a\u0443\u0434\u0430 \u0434\u0443\u0448\u0435 \u0443\u0433\u043e\u0434\u043d\u043e, \u0448\u0430\u0440\u0438\u0442\u044c \u0438 \u043b\u0430\u0439\u043a\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u043d\u043e \u0438 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435\u043c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043f\u043e\u0440\u0442\u0438\u0432\u043d\u044b\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0441\u0442\u0438 \u0437\u0434\u043e\u0440\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0436\u0438\u0437\u043d\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ac\/31c\/b84\/7ac31cb84d65ccb2781a2e928e80b06d.png\"\/><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u0440\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 GoogleFit API \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 Android \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435: \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 \u043e\u0431\u043b\u0430\u043a\u043e \u0438 \u0432\u044b\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u0415\u0449\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438, \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u0449\u0438\u0435 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f GoogleFit API \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u0445. <\/p>\n<p>  <i>\u0421\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"http:\/\/habrahabr.ru\/users\/constantinemars\/\" class=\"user_link\">ConstantineMars<\/a> \u0437\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/i>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-252375","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/252375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=252375"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/252375\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=252375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=252375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=252375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}