I want to get latitude and longitude in my android application. Please provide me a code for my android application to get latitude and longitude with out using internet..thanks
Asked
Active
Viewed 1.3k times
3
-
have u refer http://stackoverflow.com/a/15192315/1915697 ??? – Yogesh Tatwal Jul 15 '13 at 10:40
-
What have you tried? There are tons of examples on the Internet with sample code. Or you could have a look at http://developer.android.com/training/location/index.html – David Wasser Jul 15 '13 at 10:49
1 Answers
2
Well, you have GPS Provider and Network Provider.
Without internet you can use only GPS Provider
Here is snippets of code:
private final float MIN_DISTANCE = 6; // 6 meters
LocationManager locationManager = (LocationManager)
m_context.getSystemService(Context.LOCATION_SERVICE);
locationManager.addGpsStatusListener(this);
LocationListener listener = this;
locationManager.requestLocationUpdates
(LocationManager.GPS_PROVIDER, 0, MIN_DISTANCE, listener);
...
public void onLocationChanged(Location location) {
/* your code */
}

Maxim Shoustin
- 77,483
- 27
- 203
- 225