com.google.android.gms.location.LocationListener 和 android.location.LocationListener 有什么区别?

what is the differents between com.google.android.gms.location.LocationListener and android.location.LocationListener?

我想问一下这两个库中的onLocaticonChange 方法。我可以从 android.location.LocationListener 捕获位置,但是当我决定通过 google.android.gms.location.LocationListener 使用 onLocationChanged 方法时,位置参数 return null.Here 是我的 build.gradle 文件:

compile 'com.google.android.gms:play-services-maps:9.0.1'
compile 'com.google.android.gms:play-services-location:9.0.1'
compile 'com.google.android.gms:play-services-ads:9.0.1'
compile 'com.google.android.gms:play-services-auth:9.0.1'
compile 'com.google.android.gms:play-services-gcm:9.0.1' 

我不知道有什么不同。任何人都可以描述我吗? 谢谢

com.google.android.gms.location.LocationListener

这带有 google 播放服务。基本上 Google 播放服务将寻找持续的位置更新以供自己使用。您将成为另外一位用户,相同的位置更新将发送给您。

android.location.LocationListener

您为您的使用设置的这个基本位置侦听器,一旦为您设置了位置提供程序作为约束集(如电池、电源、位置提供程序、准确性),位置 uapdtes 就会发送给您

差异

  1. com.google.android.gms.location.LocationListener 将需要 google 播放服务设置,android.location.LocationListener很 基本剂量不需要播放服务依赖性

  2. 大多数时候 com.google.android.gms.location.LocationListener 更快,并且会开始快速更新,因为它已经设置好并且位置已经可用。