我正在尝试使用googleApiClient
addConnectionCallbacks
mPlusClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build();
但是我收到了这个错误:
Error:(85, 81) error: incompatible types: PlusBaseActivity cannot be converted to ConnectionCallbacks
我从在线教程中获取此代码,但它似乎无法正常工作,请帮助。
答案 0 :(得分:2)
我对您正在做的事情没有任何经验,但可能是PlusBaseActivity
班级必须实施ConnectionCallbacks
才能成为'回调?像:
public class PlusBaseActivity extends Activity implements ConnectionCallbacks{
// add ConnectionCallBack methods
}
答案 1 :(得分:0)
实施方法
@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i("LOG", "Conectado ao Google Play Services!");
}
@Override
public void onConnectionSuspended(int i) {
Log.i("LOG", "Conexão Interrompida");
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.i("LOG", "Erro ao conectar: " + connectionResult);
}