2016-12-28 63 views
0

在我的游戏,我用GoogleApiClient.connect()GoogleApiClient.disconnect()但是当我连接我不能选择我的帐户中,首先选择修复帐户。我希望能够选择我的帐户进行游戏。我执行保存的游戏代码,并且希望能够选择我的帐户时,我reconect。GoogleApiClient力完全断开

我的设备保存我的帐户的所有游戏。我可以强制我的游戏选择帐户?

我的代码:

mGoogleApiClient = new GoogleApiClient.Builder(a) 
      .addConnectionCallbacks(connectionCallbacks) 
      .addOnConnectionFailedListener(cfl) 
      .addApi(Games.API) 
      .addScope(Games.SCOPE_GAMES) 
      .addScope(Drive.SCOPE_APPFOLDER) 
      .setViewForPopups(a.findViewById(android.R.id.content)) 
      .build(); 
    mGoogleApiClient.connect(); 

public static void desconectarGoogle(){ 
    if(mGoogleApiClient!=null && isSignedIn()) 
     mGoogleApiClient.disconnect(); 

} 

回答

0

您可能需要调用的方法mGoogleApiClient.signOut()mGoogleApiClient.clearDefaultAccount()在断开功能。参考这个页面的底部:Implementing Sign-in in Your Google Game

+0

clearDefaultAccount已被弃用,你的代码不工作,签出和清除默认不能解决。 –

+0

正确的代码FOS signOut是Games.signOut(mGoogleApiClient);但不要强迫在重新选择时选择帐户。 –

+0

好对不起,代码工作,是我的机器人工作室,somtimes不更新游戏:) –

0

确定为力的代码是mGoogleApiClient.signOut(),工作和强制选择帐户:)