I want to run this task every 5 Seconds even if the App is terminated
DispatchQueue.global(qos: .background).async {
MapViewModel2().checkLocationAuthorization()
let lat = UserDefaults.standard.double(forKey: Defaults.newLatitude)
let long = UserDefaults.standard.double(forKey: Defaults.newLongitude)
sendLocation(Latitude: lat, Longitude: long, id: 1)
}
I hope anyone can help me with this