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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -