Assuming you're already using google play services and have already connected (example below):
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
if (mGoogleApiClient != null) {
mGoogleApiClient.connect();
}
Now it's just:
@Override
public void onConnected(Bundle connectionHint) {
myLocation = LocationServices.FusedLocationApi.getLastLocation(
mGoogleApiClient);
if (myLocation != null) {
latText.setText(String.valueOf(myLocation.getLatitude()));
longText.setText(String.valueOf(myLocation.getLongitude()));
}
}
The documentation also has the example of getting your own location too: Android Developers