     override init() {
         super.init()
         
+        nc.addObserver(self, selector: Selector("appWillResignActive"), name: UIApplicationWillResignActiveNotification, object: nil)
+        
+        nc.addObserver(self, selector: Selector("appDidBecomeActive"), name: UIApplicationDidBecomeActiveNotification, object: nil)
+        
         let queue = dispatch_queue_create("no.malt", DISPATCH_QUEUE_SERIAL)
         centralManager = CBCentralManager(delegate: self, queue: queue)
         

        return "Hello from BTDiscovery.";
    }
    
    
    
    func delay(delay:Double, closure:()->()) {

        case CBCentralManagerState.PoweredOn:
            println("BLE state Powered On")
            state = nil
            break
        case CBCentralManagerState.Unknown:
            println("BLE state unknown")
