Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS Getting location updates when app terminated without using significantChange

I apologise for the redundancy of this topic, but in spite all the given answers, I can't identify the possibility of getting accuracyBest location updates when the app is terminated. I don't want to use monitoringSignificantChange, I want the best possible accuracy; I won't submit the app on the AppStore, so Apple restrictions are not a problem either.

I have gone through these:

-Location update even when app is killed/terminated

-iOS update location even when app is terminated

-Working with location updates when app is terminated

-http://mobileoop.com/getting-location-updates-for-ios-7-and-8-when-the-app-is-killedterminatedsuspended

and many more, but it is not clear whereas it's possible or not. I currently have my project, everything works great with significantChange but I now need better accuracy.

Could somebody tell me straight forward if getting best accuracy location update when app is killed is possible please ?

Thank you infinitely,

like image 553
scoobyDoo Avatar asked May 26 '16 02:05

scoobyDoo


People also ask

Does significant-change location service work with iOS 15?

We’re mainly using the «Significant-Change Location Service » to get updates if someone moved some distance. For users with iOS 14 or lower, everything seems to work normally. The behavior under iOS 15 is extremely strange.

What happens if I don’t stop location updates?

If you don't stop location updates, the system continues delivering location data to your app, which could drain the battery of the user's device. When you start the significant-change location service, a recently cached value may be reported to your delegate immediately.

How does the Apple Watch’s location service work?

The service relies on lower-power alternatives (such as Wi-Fi and cellular information) to determine the user’s location. It then delivers location updates to your app only when the user’s position changes by a significant amount, such as 500 meters or more.

How does the location manager update the locations of a delegate?

As new location data is obtained, the location manager calls your delegate's locationManager (_:didUpdateLocations:) method with the updated values. The locations parameter always contains at least one location and may contain more than one.


1 Answers

Looking at the below content from the Apple doc, you clearly have 2 alternatives against using significant location changes to wake a app from the background. I have marked in bold the services you can use to relaunch the app if it has been terminated.

Using Location Services in the Background Most location services are meant to be used while your app is in the foreground but some can also run in the background. In some cases, location events can even cause your app to be relaunched to process an event. To run most location services in the background, you need to enable the location updates background mode in the Capabilities tab of your Xcode project. For services that launch your app, you need to request (and be granted) “Always” authorization from the user.

The standard location service delivers events normally while an app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app. This service does not relaunch iOS apps that have been terminated.

The significant location change service delivers events normally while an app is running in the foreground or background. For a terminated iOS app, this service relaunches the app to deliver events. Use of this service requires “Always” authorization from the user.

The region monitoring service delivers events normally while an app is running in the foreground or background. (You can use this service for both geographic and beacon regions.) For a terminated iOS app, this service relaunches the app to deliver events. Use of this service requires “Always” authorization from the user.

Beacon ranging delivers events normally while an app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app and the standard location service is running. (If the beacon region’s notifyEntryStateOnDisplay property is YES, waking the device causes the app to range for beacons for a few seconds in the background.) This service does not relaunch iOS apps that have been terminated; however, you can be relaunched by monitoring beacon regions using the region monitoring service.

The heading service delivers events normally while an iOS app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app and the standard location service is running. This service does not relaunch iOS apps that have been terminated.

The visit service delivers events normally while an iOS app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app and the standard location service is running. For a terminated iOS app, this service relaunches the app to deliver events. Use of this service requires “Always” authorization from the user.

Enabling the location-updates background mode ensures that an app continues to receive location events while in the background. When the app moves to the background, the system adds the location-services indicator to the status bar to let the user know that an app is using location services. The system may still terminate the app at any time to reclaim its memory or other resources.

Also from the doc,

Getting the Visited Locations In iOS, the visits service provides an alternative to the significant location change service for apps that need location information about interesting places that the user visited. For example, if the user is in one location for an extended period of time, the service might generate an event when the user arrives at that location and another when the user leaves that location. The service is intended for apps that might already be using the significant location change service and want an even lower power way to do so. You would not use this service to create navigation apps or apps that rely on regular location updates.

Document Link:

https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/doc/uid/TP40007125-CH3-SW73

like image 110
7vikram7 Avatar answered Nov 16 '22 18:11

7vikram7