Get Location Optimizations - iOS

To optimize detection movement with battery usage.
  1. Get user location
  2. Geofencing iOS
  3. Request Quick Location Updates

Get user location

According to official documentation, we do not decide how many locations the system will send us, or how often. On the other hand, the system sends us back all the information compiled from the various instruments at its disposal. It does not make sense to try to double the information with the observation of the gyroscope, the accelerometer or the compass. The OS analyzes all of its sensors, and defines what the user is doing to send us the most reliable information possible. Models with a motion coprocessor (from 5S) see their CPU usage (and therefore battery) greatly reduced for processing this information, which allows our application to also consume little energy.

Three services are available to obtain the position of a user:

Geofencing iOS

The service of significant displacements of the phone using too much the battery without giving us enough points, we developed method using geofencing iOS.

As a user moves, we create geofencing zones around them. When the user leaves or enters one of these zones, the application will wake up (background-active), request a position, send it, then calculate new geofencing zones according to the obtained position.

GeoSearch with Regions detections

Request Quick Location Updates

If your app just needs a quick fix on the user’s location, it’s best to call the

WoosmapGeofencing.shared.refreshLocation()

Doing so automatically stops location services once the request has been fulfilled, letting location hardware power down if not being used elsewhere. Location updates requested in this manner are delivered by a callback to the LocationServiceDelegate:tracingLocation: delegate method, which you must implement in your app.