Will iOS wake up the terminated app if it's registered with location for UIBackgroundModes?

后端 未结 3 1898
無奈伤痛
無奈伤痛 2020-12-05 04:49

I know that if an app uses \"The significant-change location service\", iOS will wake it up if there\'s a location update to be delivered, even if the app is terminated.

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 05:50

    Yes, it will behave the same way except it will receive updates more often (and thus consume more battery).

    Source: App States and Multitasking under the section Tracking the User's Location.

    EDIT After re-reading, it seems that the program will be woken up from a suspended state but not a terminated one. I don't think you really need this background mode, though. It is designed for apps that need fine location info (like turn-by-turn navigation). Check out the section in the Location Programming guide about "region based" programming. The example in your comments is listed as one of the uses of this app.

    EDIT AGAIN As per the discussion in the comments, the final solution seems to be setting significant location change until the user is close enough, and then switching over to fine location change (and hoping the app doesn't get terminated during that time ^^)

提交回复
热议问题