playgameservices / android-basic-samples

Google Play game services - Android samples
Apache License 2.0
971 stars 973 forks source link

Some small fixes for the "Accessing APIs" tutorial #245

Closed ndbroadbent closed 7 years ago

ndbroadbent commented 7 years ago

I'm following the tutorial at https://developers.google.com/games/services/android/init, and these are a few little things that tripped me up. For instance, I had no idea why BaseGameUtils.resolveConnectionFailure was complaining about me passing an int instead of a String, but that was just a bug in the original BaseGameUtils code. (R.string.sign_in_other_error is actually an int, and you need to call getString() on the resource id.)

I also added the missing sign_in_other_error string from the tutorial, because I'm not sure why that was excluded.

googlebot commented 7 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


ndbroadbent commented 7 years ago

I signed it!

googlebot commented 7 years ago

CLAs look good, thanks!

stolk commented 7 years ago

This fix only changes the BaseGameUtils, but the samples themselves still try to pass a string, causing the build to fail:

E.g. ButtonClicker, MainActivity.java does:

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
  Log.d(TAG, "onConnectionFailed() called, result: " + connectionResult);

  if (mResolvingConnectionFailure) {
    Log.d(TAG, "onConnectionFailed() ignoring connection failure; already resolving.");
    return;
  }

  if (mSignInClicked || mAutoStartSignInFlow) {
    mAutoStartSignInFlow = false;
    mSignInClicked = false;
    mResolvingConnectionFailure = BaseGameUtils.resolveConnectionFailure(this, mGoogleApiClient,
        connectionResult, RC_SIGN_IN, getString(R.string.signin_other_error));
  }

  switchToScreen(R.id.screen_sign_in);
}

Error:(485, 52) error: incompatible types: String cannot be converted to int

The examples themselves need to be adjusted as well.