Skip to content

A Geolocation

Zhenke Wu edited this page Apr 24, 2018 · 1 revision

Location data collection is pushed by daily mood submission

This is the location class we are using to track visits:

https://developer.apple.com/reference/corelocation/clvisit

It explains the distantPast and distantFuture dates but doesn’t say what triggers the location change. From their documentation:

Location Services uses GPS, Bluetooth, crowd-sourced Wi-Fi hotspot, and cellular towers to determine the location of your device.

It is hard to say which one of those kicks in and when. Here is more info on the class we are using:

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.

To begin the delivery of visit-related events, assign a delegate to the location manager object and call its startMonitoringVisits() method. As the location manager generates visit events, it delivers that information to its delegate’s locationManager(_:didVisit:) method. The event data delivered to your delegate includes only the information that occurred after you started the delivery of events. In other words, if you start the delivery of events after the user arrived at an interesting location, the event delivered by the system when the user departed that location would not reflect the actual arrival time. If the system terminates your app, this service relaunches it when new visit events are ready to be delivered.

We picked CLVisits because it is supposed to be easy on the battery. Here is documentation on it and all of the location services options.

https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009497-CH1-SW1

Clone this wiki locally