hippietrail
hippietrail

Reputation: 16974

On iOS and Android if two apps have both requested GPS streams from the OS, will battery usage double?

I have a project idea that requires a GPS stream while moving.

I'm assuming due to its nature that users would typically use it and some navigation or map app at the same time.

But both my app and the navigation app would need GPS streams and GPS is known to consume battery power.

I want to know if the OS is smart enough to only query the GPS once and send the same data to both apps.

Even if the OS is smart enough, the two apps might request the GPS data at incompatible frequencies and I assume the OS would then have no way to mitigate.

So what actually happens in cases like this?

Upvotes: 2

Views: 432

Answers (2)

Paulw11
Paulw11

Reputation: 114836

On iOS, location is delivered based on a requested accuracy (with an optional filter on the distance travelled) rather than a frequency.

The battery power consumed to determine location depends on whether the GPS hardware is used and this, again, is determined by the requested accuracy. High accuracy requires the use of GPS. Lower accuracy can be delivered using techniques such as WiFi network analysis and cell-tower information, with correspondingly lower impact on energy use.

Since there is only one GPS receiver, if this is turned on by one app, then other apps will also receive more accurate (and typically more frequent) location updates. There will, correspondingly, be a small increase in energy use if apps have requested background location updates as CPU cycles will be used to deliver the updates by this is typically a lower impact than the energy used by the GPS chip itself.

The primary energy impact comes from turning on the receiver, not from delivering the location updates.

Apple has a guide on energy efficiency that has a chapter specifically on location and motion

Upvotes: 3

Angel Koh
Angel Koh

Reputation: 13505

For android, individual apps can request and listen for location updates. An app may get the last location that was requested earlier by another app. If the updates are too old, it'll request for a new location on its own.

Even if the OS is smart enough, the two apps might request the GPS data at incompatible frequencies and I assume the OS would then have no way to mitigate.

in this case (e.g. 2 app requesting at 10 minutes interval, offset by 5 minutes apart). the device will request for location every 5 minutes.

there is also a hardware enforced minimum timing between each request (e.g. once every 5 seconds for some devices).

take a look at the location strategies for android https://developer.android.com/guide/topics/location/strategies.html

enter image description here

Upvotes: 2

Related Questions