我想知道从手机(尤其是 Android)获取计步器数据的最佳方式是什么。首先,我以为我可以在后台运行一个任务,并通过react-native-universal-pedometer npm 包订阅步数传感器,但我发现这在 RN 中是不可能的。 然后我尝试了react-native-google-fit包,您可以在其中查询从日期到日期的步骤数据,但该模块有很多错误。 有没有更好的方法来获取计步器数据以及平均步行速度,同时保持电池效率?
最佳答案
您可以使用以下方法:
1- Google 健身 API:https://www.npmjs.com/package/react-native-google-fit
2-世博计步器:https://docs.expo.io/versions/latest/sdk/pedometer/
3- 使用传感器创建您自己的计步器 native 模块:https://react-native-sensors.github.io/docs/Usage.html
关于android - 获取计步器数据的最佳方式 React Native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54688725/