내 앱에서 15 분마다 GPS 위치 데이터를 내 서버로 보냅니다. 이 기능은 앱의 주요 목적입니다.배터리 최적화가 허용되지 않음 Doze가 내 앱을 지연하지 못하게 함
그러나 휴대 전화를 끄고 사용하지 않을 때 GPS 기록은 점점 가파립니다. GPS 기록 사이의 시간은 잠시 동안 15 분간, 그 다음에 1 시간, 2 시간, 4 시간, 6 시간 후 15 분으로 이동합니다.
이것은 Android 6에 도입 된 Doze 모드로 인한 것 같습니다. 배터리 최적화 화이트리스트에 앱을 추가했지만 그 차이는 없습니다 (despite the documentation claiming otherwise).
- 왜이 경우 허용 목록에 도움이되지 않습니까?
대신 무엇을해야합니까? 정기적 인 간격으로 Wakelock을 지연시켜 Doze를 방지 할 수 있습니까?
// Request frequent location updates. Intent locationUpdateIntent = new Intent(this, StoreLocationService.class); locationUpdateIntent.setAction(MyAwesomeActionName); LocationRequest locationRequest = LocationRequest.create(); locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); locationRequest.setInterval(15 * 60 * 1000); // 15 minutes locationRequest.setFastestInterval(15 * 60 * 1000); // 15 minutes LocationServices.FusedLocationApi.requestLocationUpdates( mGoogleApiClient, locationRequest, PendingIntent.getService(this, 0, locationUpdateIntent, 0));