/// <summary>
/// 检查GPS信息
/// </summary>
/// <returns>返回OK表示成功!其他表示失败</returns>
public static string CheckGPS()
{
string info = "GPS未知状态!";

LocationServiceStatus status = Input.location.status;

if (status == LocationServiceStatus.Failed)
{
info = "未找到GPS信号!";
}
else if (status == LocationServiceStatus.Stopped)
{
info = "未找到GPS信号!";
}
else if (status == LocationServiceStatus.Initializing)
{
info = "等待GPS信号!";
}
else if (status == LocationServiceStatus.Running)
{
if (Input.location.lastData.horizontalAccuracy > desiredAccuracy)
{
info = "GPS信号微弱!";
}
else
{
info = "OK";
}
}

return info;
}

 

Unity QQ交流群:299412191 欢迎对Unity感兴趣的同学加入.