I am writing an application that shows your location on a google map ... so far, so good ... It correctly shows my location.
The problem is that this gps does not update if I move (or this happens, but only after a while)
Does anyone know how to do it the way native google maps do (for android)? This means that if you press "my location", a flashing blue dot will appear on the screen, which changes as you move ...
This is my code:
//Initializing the listeners locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 35000, 10, networkLocationListener); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 35000, 10, gpsLocationListener); //and now, in both 'networkLocationListener' and 'gpsLocationListener' //I overwrite the method 'onLocationChanged': @Override public void onLocationChanged(Location location) { Log.i("test", "New network location: "+location.getLatitude()+ " , "+location.getLongitude()); myLongitude= location.getLongitude(); myLatitude= location.getLatitude(); } //and the variables myLongitude and myLatitude are the only ones that I need to display my //position in the map...
Does anyone know if I missed something?
source share