LocationClient jest przestarzałe. Musisz użyć GoogleApiclient
coś takiego:
1: Zadeklaruj zmienną GoogleApiClient
private GoogleApiClient mGoogleApiClient;
2: instancję
mGoogleApiClient = new GoogleApiClient.Builder(mThisActivity)
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
3: Wdrożenie oddzwan
public class YourClass extends BaseFragment implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener, LocationListener {
@Override
public void onConnectionFailed(ConnectionResult result) {
// your code goes here
}
@Override
public void onConnected(Bundle connectionHint) {
//your code goes here
}
@Override
public void onConnectionSuspended(int cause) {
//your code goes here
}
}
4: uruchom aby uzyskać aktualizacje lokalizacji:
LocationServices.FusedLocationApi.requestLocationUpdates(
mGoogleApiClient, mLocationRequest, this);
5: Usuń lokalizację Aktualizacje:
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
6: Get ostatniej znanej lokalizacji:
private Location mCurrentLocation;
mCurrentLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
Właśnie aktualizuję "dodatki \ usługa Google Play" poprzez "Menedżer Android SDK", a najnowsze "google-play-services.jar" zawierają plik "LocationClient.class"; (i stary plik "google-play-services.jar" właśnie został pobrany 5 dni temu) –