Xcode: How to show GPS strength value?

流过昼夜 提交于 2019-12-03 17:05:01

问题


I am trying to get the GPS strength value to show if the signal is strong or weak. Does anyone know how to get the value.

Thanks in advance.


回答1:


use the properties of CLLocation like horizontalAccuracy and verticalAccuracy which indicate how accurate the device believes that location fix to be.

and u can use

 if (someLocation.horizontalAccuracy < 0)
{
    // No Signal
}
else if (someLocation.horizontalAccuracy > 163)
{
    // Poor Signal
}
else if (someLocation.horizontalAccuracy > 48)
{
    // Average Signal
}
else
{
    // Full Signal
}

taken from link hope it helps. happy coding :)




回答2:


You could have used the excellent search function of stackoverflow and find this solution:

Finding GPS signal strength




回答3:


You don't have direct access to number of visible satellites or signal strength.

You could however calculate fake signal strength from accuracy.

-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
   NSLog (@"accuracy: H:%.2f, V:%.2f", newLocation.horizontalAccuracy, newLocation.verticalAccuracy);
}


来源:https://stackoverflow.com/questions/10583449/xcode-how-to-show-gps-strength-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!