我有这个问题:
GoogleApiClient.ConnectionCallbacks methods not being called after connecting to the GoogleApiClient
但回调已添加,但仍然没有onConnection回调,没有错误为什么会这样?有人可以帮忙吗?
我的代码:
公共类MainActivity extends Activity实现了GoogleApiClient.ConnectionCallbacks,GoogleApiClient.OnConnectionFailedListener { 私有GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initGoogleApiClient();
}
private void initGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder( this )
.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
mGoogleApiClient.connect();
}
@Override
public void onConnected(Bundle bundle) {
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
protected void onDestroy() {
super.onDestroy();
mGoogleApiClient.disconnect();
}
@Override
public void onConnectionFailed(com.google.android.gms.common.ConnectionResult connectionResult) {
}
答案 0 :(得分:0)
我会再次回答我自己的问题。答案是使用调试密钥设置开发人员控制台:
https://developers.google.com/games/services/console/enabling#a_create_a_linked_application
I can’t find the Android keytool
How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?
答案 1 :(得分:0)
没关系,我已经做到了!显然你不能只是从Eclipse调试你的应用程序你必须用APK安装它,否则它不会工作。如下所述:
https://developers.google.com/games/services/android/quickstart
祝其他人浏览所有精彩的Google文档,祝你好运。
: - S