0

How can I get continue location update on every 10 minutes if my application in the background more then 5 hours?

I want to notify the user about location if the user is at the same location from every 30 minutes.and next 30 minutes

e.g user is at 'Location A' from last 30 minutes and the application is in the background. then the user will get the local notification that you are at Location A. then continue check for next 30 minutes.

How will this work for location? because OS will terminate app in the background

Macl
  • 143
  • 7
  • You can get background location updates indefinitely if you start the updates in the foreground. If the user is not moving then you may not get updates for some time, particularly if you are using a lower-accuracy location service (GPS uses a lot of battery). You would need to do the time filtering yourself by keeping track of the last time you notified the user. – Paulw11 Jul 04 '18 at 07:17
  • application track location continue till user it self not kill it from background ? do you have any reference URL which help me to understand more – Macl Jul 04 '18 at 07:50
  • 1
    @macl : Take a look at https://stackoverflow.com/questions/43182835/best-way-to-use-background-location-updates-in-ios-swift/43183274#43183274 – Sandeep Bhandari Jul 04 '18 at 07:58
  • 1
    Also read the iOS Application Programming guide section on background execution and the Core Location programming guides. There are also numerous WWDC sessions on location services best practices that you can watch – Paulw11 Jul 04 '18 at 07:58
  • 1
    @macl : Nope, if your requirement needs you to keep your app awake in every 30 min just to collect user location than you are approaching the problem wrongly. You can not keep running anything in background forever or invoke at specific interval of time. You can use location updates/background fetch modes to get a chance for your app to be invoked when certain crieteries are met n not when certain amount of time elapsed :) – Sandeep Bhandari Jul 04 '18 at 09:39
  • it means app will not work continues in background , if i set time interval to call serverside api in interval of 5 minute send location , then my app will be live in background ? – Macl Jul 04 '18 at 10:03
  • Any best way to continue access location in the background? – Macl Jul 09 '18 at 07:48

0 Answers0