Re-enabling Background Location Services When Reconnecting to a Bluetooth Device

Hi all,

We’re running into a challenge with our iOS app DriveSmarter, which uses background location updates when connected to a physical Bluetooth device (e.g., dash cam, radar detector). For battery efficiency, we disable location services in the background when no device is connected. The problem we’re now facing is:

How can we programmatically re-enable location services when a Bluetooth device reconnects while the app is still in the background?

From what I understand, Core Location doesn’t allow re-enabling background location updates unless the app returns to the foreground. But our core use case requires this to happen seamlessly in the background when the user starts driving and the device connects again.

To clarify:

We stop location updates when the device disconnects.

We want to resume location updates only when the device reconnects, even if the app is still in the background.

Manually bringing the app to the foreground is not a reliable or user-friendly option.

So my questions:

Is it possible to programmatically restart background location services upon a Bluetooth connection event while staying in the background?

If not, are there any best practices or Apple-recommended alternatives to achieve a similar result?

Any guidance, patterns, or creative solutions would be greatly appreciated!

Thanks in advance

Our first recommendation is to look into using the new Core Location APIs, making use of Core Location liveUpdates() and the new authorization paradigm, which covers situations like yours (but the app has to be in the foreground at least once).

You can watch the video What’s new in location authorization for more details on this,

If you are using the legacy APIs like startUpdatingLocation(), that call must technically be executed in the foreground. One undocumented workaround we have seen used would be to also call startMonitoringSignificantLocationChanges() once when your app is launched, and never call stop on that. This will keep your app subscribed to the location service, and then you can call startUpdatingLocation() from a Bluetooth event.

But this is an undocumented workaround that we would not recommend using, and if you decide to do so, make sure it works for your use case, and expect a number of edge cases where things might fail.

Re-enabling Background Location Services When Reconnecting to a Bluetooth Device
 
 
Q