Android Services for Android 6.5: LocationClient is missing

After upgrading to Google Play Services 6.5.87, my application could not be compiled due to the lack of the LocationCLient class.

Link documentation is damaged at the moment (404 not found)

How can i fix this? I want to receive location updates, work with geofences, etc.

+45
android google-play-services fusedlocationproviderapi location android-geofence
Dec 09 '14 at 6:22
source share
1 answer

The LocationClient class has been replaced by the new FusedLocationProviderApi and GeofencingApi , both of which use the common requestLocationUpdates () connection method:

LocationRequest locationRequest = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); PendingResult<Status> result = LocationServices.FusedLocationApi .requestLocationUpdates( googleApiClient, // your connected GoogleApiClient locationRequest, // a request to receive a new location locationListener); // the listener which will receive updated locations // Callback is asynchronous. Use await() on a background thread or listen for // the ResultCallback result.setResultCallback(new ResultCallback<Status>() { void onResult(Status status) { if (status.isSuccess()) { // Successfully registered } else if (status.hasResolution()) { // Google provides a way to fix the issue status.startResolutionForResult( activity, // your current activity used to receive the result RESULT_CODE); // the result code you'll look for in your // onActivityResult method to retry registering } else { // No recovery. Weep softly or inform the user. Log.e(TAG, "Registering failed: " + status.getStatusMessage()); } } }); 
+56
Dec 09 '14 at 6:33
source share



All Articles