com.google.android.gms.games.request.GameRequest Java Examples

The following examples show how to use com.google.android.gms.games.request.GameRequest. 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: SquashActivity.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
@Override
public void onSignInSucceeded() {
    setViewVisibility();

    ArrayList<GameRequest> requests = getGameHelper().getRequests();
    if (requests != null) {
        handleGiftRequest(requests);
    }

}
 
Example #2
Source File: SquashActivity.java    From io2014-codelabs with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_leaderboard:
        startActivityForResult(
                Games.Leaderboards.getLeaderboardIntent( getApiClient(),
                        getResources().getString(
                                R.string.leaderboard_bounces)),
                REQUEST_LEADERBOARD);
        return true;
    case R.id.menu_reset:
        return true;
    case R.id.menu_achievements:
        if (isSignedIn()) {
            startActivityForResult(
                    Games.Achievements.getAchievementsIntent( getApiClient() ),
                    REQUEST_ACHIEVEMENTS);
        }
        return true;

    case R.id.menu_send_gift:
        if (isSignedIn()) {
            Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
            Intent intent = Games.Requests.getSendIntent(getApiClient(), GameRequest.TYPE_GIFT,
                    "Gold".getBytes(), Requests.REQUEST_DEFAULT_LIFETIME_DAYS, bm, "A treasure chest!");

            startActivityForResult(intent, SEND_GIFT);


        }
        return true;

    case R.id.menu_gift_inbox:
        if (isSignedIn()) {
            startActivityForResult(Games.Requests.getInboxIntent(getApiClient()), SHOW_INBOX);
        }
        return true;
    }

    return super.onOptionsItemSelected(item);
}
 
Example #3
Source File: GameHelper.java    From Asteroid with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @return The requests, or null if none were received.
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 * incoming requests that must be
 * handled.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSucceeded()");
    }
    return mRequests;
}
 
Example #4
Source File: GameHelper.java    From Trivia-Knowledge with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSucceeded()");
    }
    return mRequests;
}
 
Example #5
Source File: GameHelper.java    From dice-heroes with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #6
Source File: GameHelper.java    From FixMath with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #7
Source File: GameHelper.java    From martianrun with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @return The requests, or null if none were received.
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 * incoming requests that must be
 * handled.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #8
Source File: GameHelper.java    From ColorPhun with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #9
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #10
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #11
Source File: GameHelper.java    From Onesearch with MIT License 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #12
Source File: GameHelper.java    From tedroid with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #13
Source File: GameHelper.java    From FlappyCow with MIT License 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}
 
Example #14
Source File: GameHelper.java    From cordova-google-play-games-services with MIT License 3 votes vote down vote up
/**
 * Returns the requests received through the onConnected bundle. This should
 * be called from your GameHelperListener's
 *
 * @link{GameHelperListener#onSignInSucceeded method, to check if there are
 *                                            incoming requests that must be
 *                                            handled.
 * @return The requests, or null if none were received.
 */
public ArrayList<GameRequest> getRequests() {
    if (!mGoogleApiClient.isConnected()) {
        Log.w(TAG, "Warning: getRequests() should only be called "
                + "when signed in, "
                + "that is, after getting onSignInSuceeded()");
    }
    return mRequests;
}