Background user location when app is terminated/suspended

后端 未结 6 2134
感情败类
感情败类 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:26

    In case you need location updates frequently but still want to save battery life, try this -

    1. Add necessary permissions for using location in background.
    2. Start the updates using startUpdatingLocation
    3. Start deferring updates when in background using allowDeferredLocationUpdatesUntilTraveled:timeout: Specify time and distance filters in this method.
    4. Make sure you read the docs here and specify all the properties correctly to get it working.

提交回复
热议问题