com.google.android.gms.appstate.AppStateManager Java Examples

The following examples show how to use com.google.android.gms.appstate.AppStateManager. 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 martianrun with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API, mPlusApiOptions);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
Example #2
Source File: GameHelper.java    From google-play-game-services-ane with MIT License 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally, you do not have
 * to do this; use this method only if you need to make nonstandard setup (e.g. adding
 * extra scopes for other APIs) on the GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after " +
                "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(mActivityForDialogs, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API, mPlusApiOptions);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API, mAppStateApiOptions);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }
    
    builder.setViewForPopups(mActivityForDialogs.getWindow().getDecorView().findViewById(android.R.id.content));

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
Example #3
Source File: GameHelper.java    From ColorPhun with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
      builder.addScope(Drive.SCOPE_APPFOLDER);
      builder.addApi(Drive.API);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
Example #4
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        if (mGamesApiOptions != null) {
            builder.addApi(Games.API, mGamesApiOptions);
        } else {
            builder.addApi(Games.API);
        }

        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        if (mPlusApiOptions != null) {
            builder.addApi(Plus.API, mPlusApiOptions);
        } else {
            builder.addApi(Plus.API);
        }
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
Example #5
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        if (mGamesApiOptions != null) {
            builder.addApi(Games.API, mGamesApiOptions);
        } else {
            builder.addApi(Games.API);
        }

        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        if (mPlusApiOptions != null) {
            builder.addApi(Plus.API, mPlusApiOptions);
        } else {
            builder.addApi(Plus.API);
        }
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
Example #6
Source File: GameHelper.java    From Onesearch with MIT License 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
      builder.addScope(Drive.SCOPE_APPFOLDER);
      builder.addApi(Drive.API);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
Example #7
Source File: GameHelper.java    From tedroid with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
Example #8
Source File: GameHelper.java    From ANE-Google-Play-Game-Services with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}