         locationManager.stopUpdatingLocation()
     }
     
+    public func allowsBackground(allow:Bool) {
+        locationManager.allowsBackgroundLocationUpdates = allow
+    }
+    
     //MARK: - private properties
     private let locationManager = CLLocationManager()
     

//MARK: - CLLocationManagerDelegate
extension CQZLocationManager:CLLocationManagerDelegate {
    public func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        if let location = locations.last {
            currentLocation = location
            delegate?.didUpdateLocation?(location)
        }
    }
    
    public func locationManager(manager: CLLocationManager,

    @objc private override init(){
        super.init()
        locationManager.delegate = self
        // Set an accuracy level. The higher, the better for energy.
        locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers
        // Enable automatic pausing
        locationManager.pausesLocationUpdatesAutomatically = true
        // Specify the type of activity your app is currently performing
        locationManager.activityType = CLActivityType.OtherNavigation
        // Enable background location updates
        locationManager.allowsBackgroundLocationUpdates = true
        // Start location updates
        locationManager.startUpdatingLocation()
    }
    
}
