Integration with Google Play Game Services fails because "Play Games callback indicates connection failure."

I have included Google Game Services in my NDK game using minimalist code example.

When launching the application, authentication fails with an error in the logs:

V/GamesNativeSDK( 7212): Play Games callback indicates connection failure.
I/GamesNativeSDK( 7212): UI interaction required to connect to Google Play.
I/TeapotNativeActivity( 7212): Sign in finished with a result of -3
I/biplane ( 7212): OnAuthActionFinished
I/biplane ( 7212): You are not logged in!
I/TeapotNativeActivity( 7212): Fetching all blocking
I/TeapotNativeActivity( 7212): --------------------------------------------------------------
I/TeapotNativeActivity( 7212): Fetching all nonblocking
I/TeapotNativeActivity( 7212): --------------------------------------------------------------
I/TeapotNativeActivity( 7212): Achievement response status: -3

      

I followed all the steps outlined in the online documentation, including:

  • Created a game service in the Google Play developer console and linked the two apps.
  • Associated app with debug key
  • Linker app with Release key
  • Took app id from linked apps (same id for both linked apps) and put it in res / values ​​/ ids.xml
  • Created leaderboards and put their ids in res / values ​​/game-ids.xml
  • Added a tag for my AndroidManifest.xml with name = "com.google.android.gms.games.APP_ID" and value = "@ string / app_id"
  • The latest Game Services app update has been downloaded.
  • Listed myself as a test user.

I'm not sure which message is the original error and which is the symptom. "Connection error" or "User interface interaction required".

Note that in the Developer Console, two related applications are listed as Ready to Publish.

The source code I am using is a verbatim copy of StateManager.cpp from the C ++ code examples, and in my android_main I also copied the example code snippet:

// gpg-cpp:  Here we create the callback on auth operations
auto callback = [&](gpg::AuthOperation op, gpg::AuthStatus status) {
    LOGI("OnAuthActionFinished");
    if (IsSuccess(status)) {
        LOGI("You are logged in!");
    } else {
        LOGI("You are not logged in!");
    }
    //engine.animating = 1;
};

if (state->savedState != NULL)
{
    // We are starting with a previous saved state; restore from it.
    engine.state = *(struct saved_state*)state->savedState;
    LOGI("Restored state");
}
else
{
    LOGI( "No saved state to restore." );
    gpg::AndroidPlatformConfiguration platform_configuration;
    platform_configuration.SetActivity(state->activity->clazz);
    // Now, create the game service (see StateManager.cpp) and pass in callback
    StateManager::InitServices(platform_configuration, NULL, callback);
}

      

+2


source to share


1 answer


So, it turns out that this behavior is intended: Automatic login (when the service starts) should fail if you haven't logged in previously.

First, you need to first initiate the login using:

game_services_->StartAuthorizationUI();

      

... before subsequent automatic logins are successful.



Also note that there are many bugs on the console which don't seem to interfere with the proper functioning of the Google Play Games service.

E/GamesNativeSDK(12369): Exception in dalvik/system/DexClassLoader.loadClass: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.games.NativeSdkEntryPoints" on path: DexPathList[[zip file "/data/data/com.steenriver.Biplane/app_.gpg.classloader/4da25210572e7e07ea67142ded62c42e.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]].
W/dalvikvm(12369): Unable to resolve superclass of Lcom/google/android/gms/common/api/d; (148)
W/dalvikvm(12369): Link of class 'Lcom/google/android/gms/common/api/d;' failed
I/dalvikvm(12369): Could not find method com.google.android.gms.common.api.d.a, referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.gl
W/dalvikvm(12369): VFY: unable to resolve static method 3084: Lcom/google/android/gms/common/api/d;.a (Landroid/support/v4/app/FragmentActivity;)Lcom/google/android/gms/common/api/d;
D/dalvikvm(12369): VFY: replacing opcode 0x71 at 0x0002
W/dalvikvm(12369): VFY: unable to find class referenced in signature (Landroid/support/v4/app/FragmentActivity;)
E/dalvikvm(12369): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.enableAutoManage
W/dalvikvm(12369): VFY: unable to resolve check-cast 149 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/api/GoogleApiClient$Builder;
D/dalvikvm(12369): VFY: replacing opcode 0x1f at 0x0010

      

One final note: oddly enough, I also saw a "user interaction" error when trying to log in without a network connection.

+4


source







All Articles