Background user location when app is terminated/suspended

后端 未结 6 2142
感情败类
感情败类 2020-12-08 20:14

I\'ve been trying to figure out how to get the user\'s location when the app is terminated like how the app Moves does it. The only way I know of doing so is with Significan

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 20:47

    You can register for regions in 500m area and register for notification region notification in them. When it reaches one if them, your app is launched in background. Then, re-register for new ones keeping that location at center.

    enter image description here

    From Apple's Documentation:

    Apps that support background execution may be relaunched by the system to handle incoming events. If an app is terminated for any reason other than the user force quitting it, the system launches the app when one of the following events happens:

    For location apps:

    • The system receives a location update that meets the app’s configured criteria for delivery.

    • The device entered or exited a registered region. (Regions can be geographic regions or iBeacon regions.)

提交回复
热议问题