0

I want to get user current location every 5 seconds, after app gets killed or terminated.

Is there any way I can achieve that?

I have tried

[locationManager startMonitoringSignificantLocationChanges]

but it only works when I move more than 500 meters or after 5 minutes.

I have also tried Background Task Identifier

UIBackgroundTaskIdentifier

but when I killed app then it is not working.

I have tried almost everything available but none of them are working.

Can I get current location using Silent Remote Notifications, because I have read it somewhere.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Nirav
  • 157
  • 12
  • 1
    you might want to read this: http://stackoverflow.com/questions/18463077/ios-location-update-even-app-is-not-running-like-find-my-iphone – Mikael Oct 28 '16 at 05:33
  • If you want to update location in background, There is Background Mode setting is there. read and try to implement from following tutorial https://www.raywenderlich.com/92428/background-modes-ios-swift-tutorial – Wolverine Oct 28 '16 at 05:36
  • Maybe one approach is to trigger a more accurate location monitoring task after the startMonitoringSignificantLocationChanges notification has been triggered in your app. That seems to be the only way actually. – Mikael Oct 28 '16 at 05:36
  • Background mode means that your app is running but in running in the background. It doesn't work when the app is killed. – Mikael Oct 28 '16 at 05:37
  • @Wolverine: I checked that tutorial, but it only works when app is in background. If I kill the app or terminate it, then it will not work.. try yourself :) – Nirav Oct 28 '16 at 05:38
  • @Mikael: what do you mean by "more accurate location monitoring task". can you explain me or give me any link please ? – Nirav Oct 28 '16 at 05:39
  • @Mikael: Can you explain me please ? – Nirav Oct 28 '16 at 05:59
  • An example here: http://stackoverflow.com/questions/34286288/startmonitoringsignificantlocationchanges-not-working-in-swift very good strategy in my opinion, for what you want to achieve. – Mikael Oct 28 '16 at 14:44

0 Answers0