IPhone GPS - turning off the battery very quickly

We are developing an application with heavy use of GPS, and we cannot optimize battery life.

Even when the device is not moved, there is significant drainage of the battery , which, according to the code, should not occur.

Here is the code:

locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = 100;
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
[locationManager startUpdatingLocation];

Ideally, we want to start GPS every 20 minutes (if there is no change in location, then save battery) OR every 5 minutes if there is a change in location. According to my developer, this is impossible to do

Previously, we used kCLLocationAccuracyBestthat consume the battery very quickly, and we now use kCLLocationAccuracyHundredMeters.

startUpdatingLocation - this is to get the GPS coordinates. There is another call to startMonitoringSignificantLocationChanges, which should get the coordinates of the AGPS, which I believe will return the coordinates when the mesh tower changes, and therefore quickly drain the battery.

distanceFilter . The minimum distance (measured in meters), the device must move in the transverse direction before the update event occurs. Based on the distance filter, we get the GPS correction from the device, and then send the updated GPS coordinates to the server.

Any help would be greatly appreciated Thank you!

+5
source share
4 answers

startMonitoringSignificantLocationChanges, , AGPS, , , , , , .

, , . GPS- WiFi- , , . , iPhone, , , . CLLocationManager -startMonitoringSignificantLocationChanges:

, , , .

" ", . , , , , .

GPS 20 ( , ) 5 , . ,

- . , , GPS 20 , , , , . , , , , .

+4

, startMonitoringSignificantLocationChanges , , . , 100 . iPhone , .

, (, ), ( 1 ), , - .

iOS , 20 5 , , , .

0

, UpdatingLocation, , UpdatingLocation, startMonitoringSignificantLocationChanges.

.

0

GPS 20 ( , ) 5 , . ,

NSTimer, startLocating ( , CLLocationManager startLocating ) 20 . , CLLocationManager stopLocating , CLLocation .

However, this means that within 20 minutes you can use a place that is completely disconnected. It depends on how you plan to use the place and how accurate it should be, but perhaps what your dev means “impossible” is that your application always needs the actual location of the user.

-1
source

All Articles