1

I need current location of user in my application on based on that location I will search on database!

I am getting current location right now by using example code given but it is not accurate. If no GPS I get location by network provider but it shows sometime 2 location names at the same location. If it is showing one name 1 min before after 2 min it will change to another location.

This code is look but do not know how to use it. Please help me out in this regard!

What is the simplest and most robust way to get the user's current location on Android?

I need to get the location name.

Community
  • 1
  • 1
Naveed Qamar
  • 127
  • 1
  • 13

1 Answers1

0

Network location is not as reliable as GPS location, so you might get some fluctuation. That's even more true if you're relying on wifi APs.

You may try to average locations or wait to see if it stabilises in some location in particular, or show the most common location (i.e., the one reported most of the time).

Aleadam
  • 40,203
  • 9
  • 86
  • 108
  • check the dev guide here: http://developer.android.com/guide/topics/location/obtaining-user-location.html#BestEstimate – Aleadam May 15 '11 at 00:59
  • See also: http://stackoverflow.com/questions/5535561/network-provider-location-accuracy-issue-in-android – Aleadam May 15 '11 at 01:01