谷歌适合录音API延迟 [英] Google fit Recording API delay

查看:270
本文介绍了谷歌适合录音API延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我为Android编写一个健身应用。我使用谷歌API适合来算的步骤。
我使用的录音API来算的步骤时,应用程序在后台。一旦应用程序是在前台,我取的步骤与历史API数显示在屏幕上。
什么情况是,计数是不正确的。有一个延迟,直到你得到正确的和更新计数。
更具体地没有数据丢失。我想,录音API与特定的时间间隔更新。

So I'm writing a fitness application for android. I'm using the Google fit API to count the steps. I'm using the Recording API to count the steps when the app is in the background. Once the app is in the foreground I'm fetching the steps count with the History API to show it on the screen. What happens is that the count is not correct. There is a delay until you get the correct and updated count. To be more specific no data is being lost. I guess that the Recording API is updating with a specific time interval.

我还使用传感器API它运行时显示在我的活动真正的计数。那么,什么情况是,比如你看到你的屏幕(实时数据)300步。关闭应用程序,再然后打开它你看,例如250步下一分钟。只有经过一段时间的历史记录API捕获正确的数据,并再次显示300。

I'm also using the Sensors API to show the real count on my Activity when it is running. So what happens is that for example you see 300 steps in your screen (real time data). Close the app, open it again and then for the next minute you see 250 steps for example. And only after some time the History API catches the correct data and shows 300 again.

有没有人找到一种方法,通过这个问题?

Has anyone found a way through this issue?

感谢您在百忙之中的长文本!

Thank you and sorry for the long text!

推荐答案

您是对的。记录API需要一些时间进行更新。还有的是,来到我的脑海双向。

Your are right. Recording API takes some time for update. There is two way that came to my mind.


  1. 总是被历史API的步骤。我的意思是活动正在运行时,只是增加历史API的检查率。这一优势是虽然它采取了一些时间,用户总是相同的次数。

  2. 另一种方法是有点复杂。存储您的传感器步骤随着时间的推移和放大器计数;应用一些逻辑,无论您是否需要添加&安培;显示此用户。

很抱歉的长文本。

这篇关于谷歌适合录音API延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆