更新时间:2022-12-26 12:18:32
忘记所有已阅读或完成的操作.使用Google的 FusedLocationProviderApi .
Forget all you've read or done. Use Google's FusedLocationProviderApi.
这是侦听位置更新的最简单方法.
It is the simplest way to listen for location updates.
您不必处理启用了哪个位置提供程序(网络,gps等).您只需要位置更新,因此可以通过FusedLocationProviderApi
You don't have to deal with which location provider(network, gps etc) is enabled. You only need the location updates, so get them easily with FusedLocationProviderApi
此处进行了描述.您可以在几分钟内完成几行,即可将其实施到您的应用中.
It is described here. You can implement it into your app with few lines and in few minutes.
此处是示例.
注意:您将需要以下依赖项:
Note: You'll need below dependency:
compile 'com.google.android.gms:play-services:8.1.0'