• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps implement native OnActivityResult (Google Play Games C++ for native apps)

Hi folks,

i have integrated Google Play Games Services for C++ into my native app. Except for one problem, everything is working just fine. When i close the achievements or the leaderboards window, i can't open it a second time. The reason for this is the following error:

Code:
GamesNativeSDK: Trying to show UI while waiting for a result from an existing UI. Please ensure that OnActivityResult is forwarded to the Games C++ SDK from your Java activity. See android_support.h for more details.

Now after having a look into android_support.h i discovered that i have to pass OnActivityResult from my activity to the Google Play Games Services SDK. That would be something like this:

Code:
// Then, in your native library, add the following forwarding functions.
//code
void Java_com_example_yourapp_YourActivity_nativeOnActivityResult(
      JNIEnv *env,
      jobject thiz,
      jobject activity,
      jint request_code,
      jint result_code,
      jobject data) {
    gpg::AndroidSupport::OnActivityResult(
        env, activity, request_code, result_code, data);
  }

Now this is the part where i would need you help. I know it would be somehow possible to do it like its done here (https://github.com/googlesamples/android-nearby-cpp), where the call the native method from java code.

The thing is, that i would prefer a solution without any java files. At the moment i am just using the native Activity which is provided by the NDK. Does anyone knows a possible solution? Thank you in advance!
 
Back
Top Bottom