【发布时间】:2016-06-22 07:22:43
【问题描述】:
我想问一下这两个库中的 onLocaticonChange 方法。我可以从 android.location.LocationListener 捕获位置,但是当我决定使用 google.android.gms.location.LocationListener 的 onLocationChanged 方法时,位置参数返回 null。这是我的 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 会为您提供来自谷歌地图的位置,该位置接近准确需要互联网,因此当您的位置发生变化时,它可能会被使用And android.location将根据最后访问的移动信号塔提供位置,因此当您的网络发生变化时,它会使用
-
我为此创建了一个库并使用这两个库,但我可以从 android.location.LocationListener 中捕获位置。另一个只是为 FusedLocationApi.getLastLocation 工作。感谢您的回复很有帮助:) @VishalMokal
标签: android location google-location-services