yoman07/SwiftBackgroundLocation

Should only stop relevant regions

asowers1 opened this issue · 3 comments

When BackgroundLocationManager calls ClearRegions, all monitored locations in CoreLocation are being stopped. If users creates a RegionConfig with less than the maximum region per sandboxed app (20), then any other regions that app was monitoring via CoreLocation would also be stopped.

fileprivate func clearRegions() {
        locationManager.monitoredRegions.forEach { region in
            locationManager.stopMonitoring(for: region)
        }
}

Great catch @asowers1 . We should fix it. You're welcome to create a PR with it.

app not working when backdround:
` if launchOptions?[UIApplicationLaunchOptionsKey.location] != nil {
// BackgroundDebug().write(string: "UIApplicationLaunchOptionsLocationKey")

        backgroundLocationManager.startBackground() { result in
            if case let .Success(location) = result {
                //                    LocationLogger().writeLocationToFile(location: location)
                if DataManager.shareManager.currentAccount != nil{
                    
                    NetworkManager.shareManager.postSEND_LOCATION(phone:(DataManager.shareManager.currentAccount?.PHONE)! , longitude: String(location.coordinate.longitude), latitude:String(location.coordinate.latitude)) { (success, _, _) in
                        print(success)
                    }
                    
                }
                
            }
        }
    }`

@candangios any solution for your problem im facing the same