From 006c974afb018118f313da54a9a1b81c72d1674c Mon Sep 17 00:00:00 2001 From: Zach Wells Date: Thu, 4 Apr 2024 10:05:30 -0500 Subject: [PATCH] Allow iOS background updates when terminated This PR enables the ability for the app to be woken up and trigger the callback even when terminated once the OS detects a significant location change (200 - 500 meters). Tested and working. --- ios/Classes/SwiftBackgroundLocationPlugin.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/ios/Classes/SwiftBackgroundLocationPlugin.swift b/ios/Classes/SwiftBackgroundLocationPlugin.swift index da87d60a..3101c1ec 100644 --- a/ios/Classes/SwiftBackgroundLocationPlugin.swift +++ b/ios/Classes/SwiftBackgroundLocationPlugin.swift @@ -21,6 +21,7 @@ public class SwiftBackgroundLocationPlugin: NSObject, FlutterPlugin, CLLocationM SwiftBackgroundLocationPlugin.locationManager = CLLocationManager() SwiftBackgroundLocationPlugin.locationManager?.delegate = self SwiftBackgroundLocationPlugin.locationManager?.requestAlwaysAuthorization() + SwiftBackgroundLocationPlugin.locationManager?.startMonitoringSignificantLocationChanges() SwiftBackgroundLocationPlugin.locationManager?.allowsBackgroundLocationUpdates = true if #available(iOS 11.0, *) {