私のアプリはGPSロケーションデータを15分ごとにサーバーに送信します。この機能はアプリの中心的な目的です。バッテリーの最適化で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));