0

我正在构建一个小原型应用程序来测试位置服务。我的应用同时使用 -startUpdatingLocation 和 -startMonitoringSignificantLocationChanges(用于后台处理)。

在这两种情况下,我都试图将一个 json 对象发送到服务器,其中包含我获得的位置数据,但我还希望能够发送某种标识符,以便我可以确定使用哪种定位服务模式获取数据(GPS、wifi、塔或至少如果它是通过上述两种服务之一。

如果这有什么不同,我将在 AppDelegate 中设置我的 CLLocationManager。

谢谢

4

1 回答 1

1

The sources that CLLocationManager uses are not provided. However, you can determine whether GPS is allowed to turn off by setting the desiredAccuracy property. As the documentation notes, an accuracy of 1 kilometer may have the GPS turn off.

For example, setting the desired accuracy for location events to one kilometer gives the location manager the flexibility to turn off GPS hardware and rely solely on the WiFi or cell radios. Turning off GPS hardware can lead to significant power savings.

You don't exactly control the GPS because other apps may be requesting a greater accuracy in the background.

You can roughly guess what was used for determining your location by examining your CLLocation object. Each CLLocation object has a property called horizontalAccuracy. This value is measured in meters. If it is less than 1 kilometer then GPS was probably used.

于 2012-06-22T22:20:32.583 回答