我正在使用 Samsung Watch 4 收集原始传感器数据(心率、加速度计、陀螺仪等)。我需要在后台连续运行数据收集应用程序。然而,手表操作系统似乎在一段时间后杀死了该应用程序。
所以我的问题是 -如何让我的应用程序在后台持续运行而不被手表操作系统中断/终止?
健康服务https://developer.android.com/training/wearables/health-services https://developer.android.com/training/wearables/health-services是处理心率问题的方法,因此您不需要应用程序始终运行。
但是,如果您特别需要加速度计和陀螺仪,则需要自行收集,那么您将必须运行前台服务。
https://developer.android.com/guide/components/foreground-services https://developer.android.com/guide/components/foreground-services
但如果您只需要加速度计和陀螺仪进行运动来检测活动,那么 WHS 可以为您做到这一点。
请参阅此处的一些示例https://github.com/android/health-samples https://github.com/android/health-samples
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)