Android:在 Android 框架位置 API 上使用 FusedLocationProviderApi 的优缺点是什么?
Android: What are the pros and cons of using FusedLocationProviderApi over Android framework location API?
Here Google 说:
The Google Play services location APIs are preferred over the Android framework location APIs (android.location) as a way of adding location awareness to your app. If you are currently using the Android framework location APIs, you are strongly encouraged to switch to the Google Play services location APIs as soon as possible.
谁能向我解释为什么(如果我)需要切换到新的 API?
我认为核心区别在于 FusedLocationProvider 使用物理传感器和 google 播放服务,而其他(位置管理器/位置列表器)使用物理传感器,如 gps 和网络。
FusedLocationProvider
FusedLocationProvider 使用硬件和 google 播放服务的组合来找到请求的上下文(位置)。
优点:
它在 gps 和基于 WiFi 的位置之间切换时提供更好的准确性和更少的电池消耗。
通过使用 location.if 的缓存对 you.Avoid 繁重的处理进行透明优化 用户拥有许多位置感知应用程序,不会浪费时间和资源等待获取新位置和使用之前的位置。
Google Play 服务 3.2 包括对基于位置的服务的多项增强。 Fused Location Provider 现在支持在请求位置更新时选择低功耗模式选项,以及注入模拟位置的能力——允许您在各种模拟条件下更有效地测试您的应用程序。blog
当希望节省电池电量并使用粗略更新时,FLP 不使用全球定位服务 (GPS),而是使用 WiFi 和手机信号塔信号。
Fused API 提供 3 个位置提供程序。
HIGH_ACCURACY 模式使用所有位置提供商
BALANCED_POWER 模式排除 gps
NO_POWER 模式使用来自其他应用程序的位置
缺点
- 位置管理器,使用 gps,虽然它需要电池,但它在没有网络的情况下也能正常工作。
- 室内精度还是个问号,好像你在室内用的app精度不好。
位置管理器速度慢但使用 gps 准确,这是准确性和电池消耗之间的权衡。
如果您打算在 Amazon、F-Droid 或除 Play Store 以外的任何地方发布它,请使用 LocationListener 或同时实现两者。有不少人不想Google自己的一举一动都被追踪
对我来说更准确的是位置管理器,因为它可以在所有平台上使用,不需要 google 游戏商店。但它需要一些时间和位置检测速度取决于一些因素,例如你是否在空旷的地方,天气等
Related Material
Here Google 说:
The Google Play services location APIs are preferred over the Android framework location APIs (android.location) as a way of adding location awareness to your app. If you are currently using the Android framework location APIs, you are strongly encouraged to switch to the Google Play services location APIs as soon as possible.
谁能向我解释为什么(如果我)需要切换到新的 API?
我认为核心区别在于 FusedLocationProvider 使用物理传感器和 google 播放服务,而其他(位置管理器/位置列表器)使用物理传感器,如 gps 和网络。
FusedLocationProvider
FusedLocationProvider 使用硬件和 google 播放服务的组合来找到请求的上下文(位置)。
优点:
它在 gps 和基于 WiFi 的位置之间切换时提供更好的准确性和更少的电池消耗。
通过使用 location.if 的缓存对 you.Avoid 繁重的处理进行透明优化 用户拥有许多位置感知应用程序,不会浪费时间和资源等待获取新位置和使用之前的位置。
Google Play 服务 3.2 包括对基于位置的服务的多项增强。 Fused Location Provider 现在支持在请求位置更新时选择低功耗模式选项,以及注入模拟位置的能力——允许您在各种模拟条件下更有效地测试您的应用程序。blog
当希望节省电池电量并使用粗略更新时,FLP 不使用全球定位服务 (GPS),而是使用 WiFi 和手机信号塔信号。
Fused API 提供 3 个位置提供程序。
HIGH_ACCURACY 模式使用所有位置提供商
BALANCED_POWER 模式排除 gps
NO_POWER 模式使用来自其他应用程序的位置
缺点
- 位置管理器,使用 gps,虽然它需要电池,但它在没有网络的情况下也能正常工作。
- 室内精度还是个问号,好像你在室内用的app精度不好。
位置管理器速度慢但使用 gps 准确,这是准确性和电池消耗之间的权衡。
如果您打算在 Amazon、F-Droid 或除 Play Store 以外的任何地方发布它,请使用 LocationListener 或同时实现两者。有不少人不想Google自己的一举一动都被追踪
对我来说更准确的是位置管理器,因为它可以在所有平台上使用,不需要 google 游戏商店。但它需要一些时间和位置检测速度取决于一些因素,例如你是否在空旷的地方,天气等
Related Material