I need to get my mobile current location using GPS programmatically. How do I do that?
Asked
Active
Viewed 3,087 times
2 Answers
3
There is a complete explanation of how obtaining the current position in the training pages of the official android documentation.

ol_v_er
- 27,094
- 6
- 48
- 61
2
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsListener);
LocationListener gpsListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
//
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
};

Rasel
- 15,499
- 6
- 40
- 50