Android位置更新 [英] Android Location update

查看:130
本文介绍了Android位置更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Android应用程序,其中需要用户的实际位置,但是我在获取该位置时遇到了困难.

Im writing an android aplication in which is required the actual location of the user, but I'm having trouble acquiring that location.

我正在使用LocationListener通过Wifi(NETWORK_PROVIDER)监听位置更新. 问题是我没有更新,我想它只会在我更改网络时发生.如果没有更新,则可以使用lastKnowLocation,但它无法为我提供实际用户的位置.

I'm using a LocationListener to listen for the location update, via Wifi (NETWORK_PROVIDER). The problem is I don't get an update, and I imagine it only happens when I change network. If I don't get updates, I can use lastKnowLocation but it does not provide me with the actual user's location.

是否可以通过NETWORK_PROVIDER强制进行位置更新?

Is there a way to force a location update, via NETWORK_PROVIDER?

欢呼

推荐答案

更好的是,建议您查看Google Play服务中的新位置API.

Even better, I suggest you look at the new Location APIs in Google Play Services.

还有一个培训课程.

这篇关于Android位置更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆