0
votes

I'm trying to use GPS for leaderboards for a few days without success. Developing using Eclipse and cocos2d-x.

After doing miles of preparations, importing 3rd party libraries and copy/pasting code from a sample project, I'm still left with errors and questions. I'm an iOS dev forced to do Android/GPS dev for a while so bear with me. (I'm an iOS user as well, I do not use Android. I might not have enough knowledge of Google world terminology.)

  • To use GPS for leaderboards, do I have to implement Google+ functionality into the app?
  • The specific error I get to onConnectionFailed() when trying to connect the GoogleApiClient instance is: "SIGN_IN_REQUIRED". What does "sign in" mean - sign in to where? Sign in to Google Play Services? Sign in to Google+? Is either fine? Why does a "connect" call to GoogleApiClient not automatically launch some sign in procedure should it be necessary? How do I force the app to show some sign in UI to the user, or at least force the app to try to use the current Google account of the device?

Some instructions I've used are:

https://developers.google.com/games/services/android/leaderboards https://developers.google.com/android/guides/setup https://github.com/playgameservices/android-basic-samples (Using BaseGameUtils as dependency library)

1
developers.google.com/games/services/android/leaderboards is more than sufficient to get it up and going. Just make sure you go through each instruction in that and linked pages correctly. As for the sign in as long as you've signed in to your Android device it will not prompt for any logins. The Google Play Services library will detect that and login automatically. In case you have logged in with multiple accounts it will prompt to pick one.JanithaR
Except it does not detect any account being logged in. In any case, connection never succeeds and always fails with SIGN_IN_REQUIRED. I'm trying to bring up the leaderboards in game, but mGoogleApiClient.isConnected() returns false so can't proceed there.Jonny
Check this. It shows how to deal with the error you're getting.JanithaR
Not really getting anywhere. Calling result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR); did nothing unless I copied a file from the sample project: res/layout/activity_main.xml and ran setContentView(R.layout.activity_main); inside onCreate() - it finally brought up an account selection UI - however selecting an account there just leaves the app in a state from which it does not proceed. The onActivityResult() is the last point which is called at this state, it ends with a resultCode of 1001, which is not the expected RESULT_OK needed for a successful connect() call.Jonny
Well at this point it's hard to suggest anything without checking your whole project.JanithaR

1 Answers

0
votes

Following the (lengthy) instructions at https://developers.google.com/games/services/android/leaderboards should be enough.