1

How many ways I can get the current geo location (lat,lang) programatically in Android, Which is the best, accurate and faster way??

Look forward to your suggestions

Thanks

Vinayak Bevinakatti
  • 40,205
  • 25
  • 108
  • 139

3 Answers3

2

You should read Obtaining User Location in the SDK's documentation.

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
  • Not sure there is a *best* way : GPS can be slow, but is quite accurate ; cell is not precise but faster ; not all device have GPS ;;; using a combinaison of several ways is probably the best way *(first, celle-tower, to quickly have a location ; then GPS, so it gets more preceise)* – Pascal MARTIN Apr 14 '11 at 11:19
  • Thanks Pascal, any code example available for reference (Using both Network provider and GPS) – Vinayak Bevinakatti Apr 14 '11 at 11:21
  • No, sorry ; there are samples in the manual, I suppose -- but I've never used them. – Pascal MARTIN Apr 14 '11 at 11:21
  • Good posting I came across http://www.android10.org/index.php/articleslocationmaps/226-android-location-providers-gps-network-passive – Vinayak Bevinakatti Apr 14 '11 at 11:31
0

When developing a location-aware application for Android, you can utilize GPS and Android's Network Location Provider to acquire the user location. Although GPS is most accurate, it only works outdoors, it quickly consumes battery power, and doesn't return the location as quickly as users want. Android's Network Location Provider determines user location using cell tower and Wi-Fi signals, providing location information in a way that works indoors and outdoors, responds faster, and uses less battery power. To obtain the user location in your application, you can use both GPS and the Network Location Provider, or just one`

locationManager.requestLocationUpdates(
                                LocationManager.GPS_PROVIDER,
                                MIN_TIME_BW_UPDATES,
                                MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                        Log.d("GPS Enabled", "GPS Enabled");
                        if (locationManager != null) {
                            loc = locationManager
                                    .getLastKnownLocation(LocationManager.GPS_PROVIDER);
                          }
locationManager.requestLocationUpdates(
                            LocationManager.NETWORK_PROVIDER,
                            MIN_TIME_BW_UPDATES,
                            MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                    Log.d("Network", "Network");
                    if (locationManager != null) {
                        loc = locationManager
                                .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

                    }
Dhananjay
  • 161
  • 2
  • 3
0

It is possible to find out location via IP address:

http://www.google.com.sg/search?aq=1&oq=identifying+location&sourceid=chrome&ie=UTF-8&q=identifying+location+of+ip+addresses

Another method is by GSM, or control-plane locating, yet other methods can be found here:

http://en.wikipedia.org/wiki/Location-based_service#Others

Peter Teoh
  • 6,337
  • 4
  • 42
  • 58