I need to get my mobile current location using GPS programmatically. How do I do that?
Asked
Active
Viewed 3,086 times
2 Answers
4
There is a complete explanation of how obtaining the current position in the training pages of the official android documentation.
ol_v_er
- 26,534
- 6
- 46
- 61
3
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
- 16,321
- 6
- 41
- 51