 		self.swizzled_viewDidAppear(animated)
 
 		automaticTracker.trackPageView()
-		didAppearBefore = true
-		guard let _ = applicationWillEnterForegroundObserver else {
-			return
+
+		if applicationDidBecomeActiveObserver == nil {
+			applicationDidBecomeActiveObserver = NSNotificationCenter.defaultCenter().addObserverForName(UIApplicationDidBecomeActiveNotification, object: nil, queue: nil) { [weak self] _ in
+				self?.applicationDidBecomeActiveWhileAppeared()
+			}
 		}
 	}
 

		swizzled = true

		swizzleMethod(ofType: UIViewController.self, fromSelector: #selector(viewDidAppear(_:)), toSelector: #selector(swizzled_viewDidAppear(_:)))
		swizzleMethod(ofType: UIViewController.self, fromSelector: #selector(viewDidDisappear(_:)), toSelector: #selector(swizzled_viewWillDisappear(_:)))
	}



	@objc(Webtrekk_viewWillDisappear:)
	private dynamic func swizzled_viewWillDisappear(animated: Bool) {
		self.swizzled_viewWillDisappear(animated)

		if let applicationDidBecomeActiveObserver = applicationDidBecomeActiveObserver {
			NSNotificationCenter.defaultCenter().removeObserver(applicationDidBecomeActiveObserver)
			self.applicationDidBecomeActiveObserver = nil
		}
	}
}
