title: Get Notified When User Starts to Drive (CoreMotion)
body: <p>I would like to send a notification to the user whenever he/she starts driving using <code>CoreMotion</code>. I can use <code>CoreMotion</code> to see what the user is doing while my app is on like so...</p>
  
  <pre><code>let activityManager = CMMotionActivityManager()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      activityManager.startActivityUpdates(to: .main) { (activity) in
          guard let activity = activity else {
              return
          }
  
          if activity.automotive {
              print("Driving")
          }
  
          if activity.stationary {
              print("Not Moving")
  
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But how would I be able to detect the change to <code>activity.automotive</code> in the background to send a notification to the user even if my app is not on?</p>