SDKBox Play problem

SDKBox Play problem
0.0 0

#1

Hi,
I’ve problems with SDKBOX Play in Android.
This is my method for show the leaderboards:

void EventHandler::onTouchLeaderIcon(Ref *pSender)
{
  if(sdkbox::PluginSdkboxPlay::isSignedIn() == true)
      sdkbox::PluginSdkboxPlay::showAllLeaderboards();
  else
  {
      sdkbox::PluginSdkboxPlay::signin();
      redirectToEventPlayLeaderBoard = true; 
  }
} 

If the player has logged in, leaderboards will show.
Else, I invite the player to login in GameCenter or Google Play. And after login ok, I redirect to the leaderboards.
This is the method onConnectionStatusChanged (Listener)

void PlayHandler::onConnectionStatusChanged(int status)
{
    if(status == sdkbox::GPS_CONNECTED
       && EventHandler::getInstance()->getRedirectToEventPlayLeaderBoard() == true)
    {
        EventHandler::getInstance()->onTouchLeaderIcon(NULL);
        EventHandler::getInstance()->setRedirectToEventPlayLeaderBoard(false);
    }
}

If the status is GPS_CONNECTED (login ok) and the flag for redirect to the leaderboards is true (redirectToEventPlayLeaderBoard) then I call again onTouchLeaderIcon for show the leaderaboards (this method should enter in the first if statment because isSignedin is true).

Ok, this logic in iPhone works perfect. If I logged in to GameCenter, the method shows me the leaderboards. If not, the method invites me to log in to GameCenter and If i login ok I redirect to the leaderaboards.

My problem is with Android.
I’m testing in a real Android device and I don’t understand why it’s not work (the code is the same for Android and iOS). In the app “Play Games” I logged in with my gmail / user. After that I touch the leaderaboards icon and Play Services tries to init but I’m not redirect to the leaderaboards or login.
I only view the init box of Google Play and after that it disappears.

I debugged it, and when I touch the icon, the method onTouchLeaderIcon is called and isSignedIn is false (I don’t understand why because I signed in to play services).
Then, sdkbox::PluginSdkboxPlay::signin(); is called and the listener calls the method onConnectionStatusChanged but the problem is that the status is 1001! (sdkbox::GPS_DISCONNECTED). Why? I never call sdkbox::PluginSdkboxPlay::signout()
Because of it, I never redirects to the leaderboards.

The main problem is why isSignedIn is false? I’m logged in.
And why if i’m calling sigin() I don’t view the inputs for login?
I repeat, in iOS works perfect and the code is the same. @nite ? @yinjimmy ? Anyone?
Maybe any debug mode? But is false… the app is published and it doesn’t work.


#2

signin result is 1001/sdkbox::GPS_DISCONNECTED, there maybe many reason.

you can check follow point:

  1. release mode
  2. keystore
  3. package name
  4. sdkbox_config.json
  5. google console web side config

other way, compare with sdkbox-sample-sdkboxplay


#3

@htlxyz can you explain me with more details the posible problems?

What problem I could have here?

The app is in production. I assume that the app is signed correctly and the package is correct. If my keystore is wrong I could not upload the app.

This is my config:

 "sdkboxplay": {
        "leaderboards": [
            {
                "id": "ID", 
                "name": "Best Scores"
            }, 
            {
                "id": "ID", 
                "name": "Best Times 2048"
            }, 
            {
                "id": "ID", 
                "name": "Best Times 1024"
            }, 
            {
                "id": "ID", 
                "name": "Best Times 512"
            }
        ], 
		"web_client_id": "4515782215-55ou692vh9n0qd3n09u50qbftrqf9mi.apps.googleusercontent.com",
        "clound_save": false, 
        "connect_on_start": false, 
        "show_achievement_notification": false, 
        "debug": false
    }, 

The ID of leaderboards are OK. I checked it. What could be the problem here? I’ve no idea what’s web_client_id.

??


#4

I think my problem is a configuration problem, not code problem. Because in iOS works perfect.


#5

what about the

<string name="google_app_id">777734739048</string>

in strings.xml.


#6

i agree, this is a configuraion issue.

i got log
Error connecting to play services, reason: 'SIGN_IN_REQUIRED(4)'
in your game

sdkbox_config.json

if you needn’t server auth code, you can remove web_client_id

google console web side config

eg. make sure Drive API is enable.

as jimmy saying, make sure google_app_id is correct


#7

Yes! My google_app_id was wrong. I fixed it and now it works!
Thanks @htlxyz !! Thanks @yinjimmy !!
:blush:


#8

For me it was the tester account, I was using a device with a different account that was not listed as tester in the console. After adding it, it returns code 1000 rather than 1001.