title: AppDelegate methods not called when using Firebase Cloud Messaging (FCM)
body: <p>Since I installed Firebase with FCM for notifications, most of my appDelegate methods aren't called anymore (except <code>didFinishLaunchingWithOptions</code>:  <code>applicationDidEnterBackground</code> or <code>applicationDidBecomeActive</code> for example.
  Is there something else to do to retrieve the AppDelegate normal behavior? Thanks!</p>
  
  <pre class="lang-swift prettyprint-override"><code>
  import UIKit
  import Firebase
  
  @UIApplicationMain
  class AppDelegate: UIResponder, UIApplicationDelegate {
  
      var window: UIWindow?
  
  // Still called, app launches UI normally.
      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool {
           FirebaseOptions.defaultOptions()?.deepLinkURLScheme = Bundle.main.bundleIdentifier
          FirebaseApp.configure()        
          UNUserNotificationCenter.current().delegate = self
          Messaging.messaging().delegate = self
          let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
          UNUserNotificationCenter.current().requestAuthorization(
            options: authOptions,
            completionHandler: {_, _ in })
          application.registerForRemoteNotifications()
          self.window = UIWindow(frame: UIScreen.main.bounds)
          self.window?.rootViewController = LoadingViewController.instantiate()
          self.window?.makeKeyAndVisible()
          return true 
      }
  
  // Not called anymore 
      func applicationWillResignActive(_ application: UIApplication) {
          log.verbose("applicationWillResignActive") 
      }
  
  // Not called anymore   
      func applicationDidEnterBackground(_ application: UIApplication) {
          log.verbose("applicationDidEnterBackground")
          RideController.shared.prepareForBackground() 
      }
  
  // Not called anymore  
      func applicationWillEnterForeground(_ application: UIApplication) {
          log.verbose("applicationWillEnterForeground") 
      }
  
  // Not called anymore
      func applicationDidBecomeActive(_ application: UIApplication) {
          log.verbose("applicationDidBecomeActive")
          RideController.shared.prepareForForeground() // Not called anymore
          // Watch
          WatchController.shared.startSession() 
      }
  
      func applicationWillTerminate(_ application: UIApplication) {
          log.verbose("applicationWillTerminate")
          RideController.shared.prepareForBackground()
      }
  
  }
  
  / MARK: - UNUserNotificationCenterDelegate methods
  extension AppDelegate: UNUserNotificationCenterDelegate {
  
      func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Swift.Void) {
          Messaging.messaging().appDidReceiveMessage(notification.request.content.userInfo)
      }
  
  
  // MARK: - MessagingDelegate methods
  extension AppDelegate: MessagingDelegate {
  
      func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
          log.info("FCM registration token received = \(fcmToken)")
          let dataDict:[String: String] = ["token": fcmToken]
          NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
      }
  
      func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
          log.info("didReceive message = \(remoteMessage)")
      }
  }
  
  </code></pre>