LocationClient class not found in google play services rev 22

I just upgraded Google Play services to version 22 and the LocationClient class seems to be missing. What's happening?

+27
android google-play-services eclipse-luna
Dec 08 '14 at 19:53
source share
1 answer

Based on what @CommnsWare said, here are the steps to switch to Fused api.

Step 1. Get an instance of GoogleApiClient instead of LocationClient .

ConnectionCallback (mConnectionCallbacks, mOnConnectionFailedListener in the example below) needs a little modification, but this should be trivial.

 googleApiClient = new GoogleApiClient.Builder(this) .addApi(LocationServices.API) .addConnectionCallbacks(mConnectionCallbacks) .addOnConnectionFailedListener(mOnConnectionFailedListener) .build(); 

Step 2. Update call connection and disconnection.

Replace locationClient.connect() with googleApiClient.connect() and locationClient.disconnect() with googleApiClient.disconnect() .

Step 3: Use LocationServices.FusedLocationApi to send your requests. eg.

 LocationServices.FusedLocationApi.getLastLocation(googleApiClient) LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request, mLocationListener); 

Hope this helps!

+68
Dec 09 '14 at 6:40
source share



All Articles