Java Code Examples for com.google.android.gms.games.Games#signOut()

The following examples show how to use com.google.android.gms.games.Games#signOut() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameHelper.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
    notifyListener(false);
}
 
Example 2
Source File: GameHelper.java    From ColorPhun with Apache License 2.0 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 3
Source File: GameHelper.java    From ANE-Google-Play-Game-Services with Apache License 2.0 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
  public void signOut() {
      if (!mGoogleApiClient.isConnected()) {
          // nothing to do
          debugLog("signOut: was already disconnected, ignoring.");
          return;
      }

      // for Plus, "signing out" means clearing the default account and
      // then disconnecting
      if (0 != (mRequestedClients & CLIENT_PLUS)) {
          debugLog("Clearing default account on PlusClient.");
          Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
      }

      // For the games client, signing out means calling signOut and
      // disconnecting
      if (0 != (mRequestedClients & CLIENT_GAMES)) {
          debugLog("Signing out from the Google API Client.");
          Games.signOut(mGoogleApiClient);
      }

      // Ready to disconnect
      debugLog("Disconnecting client.");
      mConnectOnStart = false;
      mConnecting = false;
mConnectionResult = null;
mGoogleApiClient.disconnect();
  }
 
Example 4
Source File: Activity_Main.java    From Pedometer with Apache License 2.0 5 votes vote down vote up
public void signOut() {
    if (mGoogleApiClient.isConnected()) {
        Games.signOut(mGoogleApiClient);
        mGoogleApiClient.disconnect();
    }
    getSharedPreferences("pedometer_playservices", Context.MODE_PRIVATE).edit()
            .putBoolean("autosignin", false).apply();
}
 
Example 5
Source File: GameHelper.java    From cordova-google-play-games-services with MIT License 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 6
Source File: GameHelper.java    From FlappyCow with MIT License 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 7
Source File: GameHelper.java    From tedroid with Apache License 2.0 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 8
Source File: GameHelper.java    From Onesearch with MIT License 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 9
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 10
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 11
Source File: GpgsClient.java    From gdx-gamesvcs with Apache License 2.0 5 votes vote down vote up
public void disconnect(boolean autoEnd) {

        if (isSessionActive()) {
            Gdx.app.log(GAMESERVICE_ID, "Disconnecting with autoEnd " + autoEnd);
            if (!autoEnd)
                try {
                    Games.signOut(mGoogleApiClient);
                } catch (Throwable t) {
                    // eat security exceptions when already signed out via gpgs ui
                }
            mGoogleApiClient.disconnect();
            if (gameListener != null)
                gameListener.gsOnSessionInactive();
        }
    }
 
Example 12
Source File: GameHelper.java    From google-play-game-services-ane with MIT License 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from GamesClient.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 13
Source File: GameHelper.java    From martianrun with Apache License 2.0 5 votes vote down vote up
/**
 * Sign out and disconnect from the APIs.
 */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 14
Source File: SoomlaGooglePlus.java    From android-profile with Apache License 2.0 5 votes vote down vote up
@Override
public void logout(AuthCallbacks.LogoutListener logoutListener) {
    try {
        Plus.AccountApi.clearDefaultAccount(googleApiClient);
        if (enableGameServices) {
            Games.signOut(googleApiClient);
        }
        googleApiClient.disconnect();
        logoutListener.success();
    } catch (Exception e) {
        logoutListener.fail("Failed to logout with exception: " + e.getMessage());
    }
}
 
Example 15
Source File: DrawingActivity.java    From 8bitartist with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.sign_in_button:
            mSignInClicked = true;
            mGoogleApiClient.connect();
            findViewById(R.id.sign_in_button).setVisibility(View.GONE);
            break;
        case R.id.sign_out_button:
            mSignInClicked = false;
            Games.signOut(mGoogleApiClient);
            mGoogleApiClient.disconnect();
            updateViewVisibility();
            break;
        case R.id.startMatchButton:
            onStartMatchClicked();
            break;
        case R.id.partyModeHostButton:
            onHostPartyClicked();
            break;
        case R.id.partyModeJoinButton:
            onJoinPartyClicked();
            break;
        case R.id.clearButton:
            onClearClicked();
            break;
        case R.id.doneButton:
            onDoneClicked();
            break;
    }
}
 
Example 16
Source File: GameHelper.java    From FixMath with Apache License 2.0 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 17
Source File: GameHelper.java    From Trivia-Knowledge with Apache License 2.0 5 votes vote down vote up
/** Sign out and disconnect from the APIs. */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}
 
Example 18
Source File: GameHelper.java    From Asteroid with Apache License 2.0 5 votes vote down vote up
/**
 * Sign out and disconnect from the APIs.
 */
public void signOut() {
    if (!mGoogleApiClient.isConnected()) {
        // nothing to do
        debugLog("signOut: was already disconnected, ignoring.");
        return;
    }

    // for Plus, "signing out" means clearing the default account and
    // then disconnecting
    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        debugLog("Clearing default account on PlusClient.");
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    }

    // For the games client, signing out means calling signOut and
    // disconnecting
    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        debugLog("Signing out from the Google API Client.");
        Games.signOut(mGoogleApiClient);
    }

    // Ready to disconnect
    debugLog("Disconnecting client.");
    mConnectOnStart = false;
    mConnecting = false;
    mGoogleApiClient.disconnect();
}