I'm using
myLocation = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
to retrieve the current location at the start-up of my application.
As the Android documentation states, this location can be "out-of-date", since the method returns the location when the GPS was used the last time.
How can I actively request the current location from the GPS? I thought about using LocationListener
, however that might be a bit of an overkill, since I only need the location once (at the start of my app).
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…