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.
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!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…