Search code examples
androidlocationandroid-fusedlocationandroid-8.0-oreo

Android O: what will be effect of the new version of Android on Location Updates?


My app is currently using PendingIntent.getBroadcast to receive location updates from FusedLocationApi. How will my location updates be affected in Android O? I went through the documentation given in this link: https://developer.android.com/preview/features/background.html#broadcasts. But I am still not sure about my situation. I have no foreground or background services to receive location updates from FusedLocationApi. I have registered a broadcast receiver which keeps listening to any updates from FusedLocationApi.

Thanks in advance.


Solution

  • Yes, your app is affected in several ways. You will receive updates only few times in a hour regardless how you setup the location request. In addition you can't start a service from your receiver, you can do it only if the service is in foreground or the user excluded your app from battery opmizations. So if you really need frequent updates, you need to start a foreground service in order to keep your app in foreground. The service can be "empty" (no work), you can keep your current design, the goal is just to keep your app in foreground