2016-12-04 43 views
1

我想使用Google API客戶端獲取最後一個已知位置,但我遇到了與它不兼容的問題。任何人都可以指出我錯過了什麼?不兼容的類型。必需:GoogleApiClient找到:GoogleApiClient.Builder

import android.support.v4.app.FragmentActivity; 
import android.os.Bundle; 

import com.google.android.gms.common.ConnectionResult; 
import com.google.android.gms.common.api.GoogleApiClient; 
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; 
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.OnMapReadyCallback; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, OnConnectionFailedListener, 
     ConnectionCallbacks{ 

    private GoogleMap mMap; 
    private GoogleApiClient mGoogleApiClient; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_maps); 

     // getting incompatible issue in below line 
     mGoogleApiClient = new GoogleApiClient.Builder(this); 

     // Obtain the SupportMapFragment and get notified when the map is ready   to be used. 
     SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 
       .findFragmentById(R.id.map); 
     mapFragment.getMapAsync(this); 
    } 

回答

0

試試這個。

 mGoogleApiClient = new GoogleApiClient.Builder(this).build();