Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect advice in android_support.h file from SDK. #57

Open
stolk opened this issue Mar 5, 2019 · 0 comments
Open

Incorrect advice in android_support.h file from SDK. #57

stolk opened this issue Mar 5, 2019 · 0 comments

Comments

@stolk
Copy link

stolk commented Mar 5, 2019

In the gpg-cpp-sdk v 3.0.1 there is a file android/include/gpg/android_support.h

This file mentions:

* <h1>Example code for an Android 4.0+ game using a Java Activity</h1>
 * In your Java Activity, please add the following. You may need to merge this
 * code with your existing lifecycle functions.
 * \code
 * public class YourActivity extends Activity {
 *   protected void onActivityResult(int requestCode,
 *                                   int resultCode,
 *                                   Intent data) {
 *     super.onActivityResult(requestCode, resultCode, data);
 *     nativeOnActivityResult(this, requestCode, resultCode, data);
 *   }
 *
 *   // Implemented in C++.
 *   private static native void nativeOnActivityResult(
 *       Activity activity,
 *       int requestCode,
 *       int resultCode,
 *       Intent data);
 * }
 * \endcode
 * 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);
 * }
 * \endcode

These code snippets are incorrect.

The Java part of the code defines a static function, without a 'thiz' pointer.

The C part of the code defines a non static function, with a 'thiz' pointer.

These do not rhyme.

Causing android studio to warn:

image

Please address, @hak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant