GPS 和 Google 定位服务 API 与框架定位 API (android.location)

GPS & Google Location Services API vs Framework Location API (android.location)

我正在开发一个需要访问 GPS 状态的应用程序,并获取有关星座类型等可见卫星的数据,它是否用于定位、海拔出口等。我一直在使用 Android 框架在 android.location package for that, especially GnssStauts. Now, I see that Google recommends switching to using Location Services API from Google Play services because it does a lot of things instead of us (Geofencing, Activity Recognition...), and is more energy efficient and I understand that, I have started using it for getting user location. But, I cannot find out how to use it for more complex needs, like getting GPS satellites data, like I described in the beginning. Am I missing something very obvious here, or Google still didn't cover that type of use cases with new Location Services API (but forgot to mention that anywhere in documentation), so for that cases we should still stick to good old android.location 框架中有 类 的位置 API?

定位服务 API 尝试不使用 GPS,而是尝试从其他来源(如 wifi、蜂窝信号等)进行计算,以避免必须打开 GPS 芯片。通常它比网络更准确,但不如 GPS。 (从技术上讲,我相信它可以被迫只使用 GPS,但这不是使用它的正常方式)。如果您需要有关卫星的实际 GPS 数据,它不会帮助您。如果您需要 运行 在非 Google 批准的设备上,它不会帮助您(除非他们盗版 Google Play 服务)。对于您的用例,我会跳过它,只使用内置的位置代码。