Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

請問如何取得即時健康數據 #41

Open
komindy12 opened this issue Aug 27, 2020 · 2 comments
Open

請問如何取得即時健康數據 #41

komindy12 opened this issue Aug 27, 2020 · 2 comments

Comments

@komindy12
Copy link

您好,想請教一下想要取得即時的健康數據,程式碼該怎麼寫
只需要即時的步數、睡眠、心率、血氧。
另外就是我使用TableSleepRecord裡的方法時程式都會直接發生錯誤,不知道問題是出在哪
下面是我目前寫的樣子,再麻煩專員解惑了
githubissue

@rik296
Copy link

rik296 commented Aug 27, 2020

Hi, 您好,
要取得健康數據,只要確定手環是在連線中的狀態,呼叫 SDK 中的 doSyncFitnessData() 即可在 callback onGetFitnessData() 獲得數據資料,若您的需求是即時的話,我們目前手環儲存資料的頻率是這樣的:

步數:20 分鐘儲存一筆完整資料
睡眠:10 分鐘儲存一筆完整資料
心率與血氧:可透過 setting 功能調整成最短 1 分鐘儲存一筆

您可以在 onGetFitnessData() callback 中,設置一個 timer handler,就可以定時獲取健康資料

另外,您提到的 TableSleepRecord,因為這是一個 class,您可以在 sleepRecords.get(0) 後使用 toJSONString() 轉成 JSON string,以上供您參考

@komindy12
Copy link
Author

好的謝謝,我先研究看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants