1 Reply
      Latest reply on Apr 1, 2019 2:24 AM by eskimo
      3131 Level 1 Level 1 (0 points)

        I've done some research about background events on ios, and there are not many options... I need to create an app that at least starts the app in the background when the phone starts or stops charging.

        • Re: isBatteryCharging event in background
          eskimo Apple Staff Apple Staff (11,225 points)

          I need to create an app that at least starts the app in the background when the phone starts or stops charging.

          iOS does not let you run arbitrary tasks in the background.  By default apps get suspended shortly after being moved to the background and only get resumed (or relaunched) when the user brings them to the front.  To get resumed (or relaunched) in the background your must take advantage of some specific system service, like Core Location’s significant location change feature, or the background session support in NSURLSession.  There is no explicit background support for power management events, and thus you won’t be able to achieve this goal.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"