         
         queue.name = "TileDownloadQueue"
         queue.maxConcurrentOperationCount = 1
+        
+        startBackgroundTask()
         
         queue.addOperation {
             

        
        var count = 0
        
//        let qos = Int(DispatchQoS.QoSClass.userInitiated.rawValue)
        
        DispatchQueue.global(priority: .background).async { () -> Void in
            

                            
                            self.stopDownloading()
                            
                            self.stopBackgroundTask()
                            
                            let alertController = UIAlertController (title: "Thank you!", message: "Maps will be switched automatically once you will be offline", preferredStyle: .alert)
                            
                            let action = UIAlertAction(title:"Ok", style: .default) { (_) -> Void in
