My app lets people record routes when driving. To ensure locations are actually recorded, i use a service
so that they are recorded even if the activity is killed. To avoid the device being put into Doze, which would mean not getting frequent location updates, i hold a wakelock.
Are these steps sufficient? Or do i need to explicitly disable battery optimization ( https://developer.android.com/training/monitoring-device-state/doze-standby.html ) to ensure i dont lose out on location updates? According to the docs, my app seems like an "acceptable" use-case for that.
答案 0 :(得分:1)
前景服务不受打瞌睡的影响 - 如果您想要经常运行并获得高精度的位置,您应该是一个前台服务。