Android: GPS is giving last saved location -



Android: GPS is giving last saved location -

i working on getting current location through gps. gps giving me lastly saved location! may because of line! looking improve solution!

locationmanager .getlastknownlocation(locationmanager.gps_provider);

here sample code

if (isgpsenabled) { if (location == null) { locationmanager.requestlocationupdates( locationmanager.gps_provider, min_time_bw_updates, min_distance_change_for_updates, this); log.d("gps enabled", "gps enabled"); if (locationmanager != null) { location = locationmanager .getlastknownlocation(locationmanager.gps_provider); if (location != null) { latitude = location.getlatitude(); longitude = location.getlongitude(); } } } }

thanks in advance!

if utilize

locationmanager .getlastknownlocation(locationmanager.gps_provider);

it homecoming lastly location saved gps internally.

as have added listner can next changed location on onlocationchanged overrided function closest location need.

there no way rather need wait till onlocationchanged function triggered automatically...

android gps

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -