android – What is the alternative implementation of LocationClient in Google Play Services SDK 6.5?

Question: Question:

After updating the Google Play Service SDK to 6.5, Location Client is no longer available. What should I do with an alternative implementation?

Answer: Answer:

LocationClient has been deprecated and will now use Google ApiClient instead.

public class MyActivity implements GoogleApiClient.ConnectionCallbacks,                   
                                   GoogleApiClient.OnConnectionFailedListener {
  private GoogleApiClient locationClient;

  protected void onCreate(Bundle bundle) {
    locationClient = new GoogleApiClient.Builder(ctx)

  // 最新の現在地を取得
  public Location getLastLocation() {

The above is a simplified code example.

Also, specify the following in build.gradle .

compile ''
Scroll to Top