I am trying to add billing in an application in my cocos2dx-android project. I can give a java function call from a C ++ class via jni.
So I will call the java function through jni.
JniMethodInfo t; JniHelper::getStaticMethodInfo(t , "com/test/project/Project" , "BuyProduct" , "(Ljava/lang/String;)V"); char buffer[20]; sprintf(buffer,"product1"); jstring StringArg1 = t.env->NewStringUTF(buffer); t.env->CallStaticVoidMethod(t.classID, t.methodID, StringArg1);
Billing in the application works fine, but now I need to give an answer to my C ++ class to find out whether the product was successfully purchased or not.
I could return the result of the called method only by indicating the specified type of return value, but the in-app process, which is an asynchronous process, goes through many method calls, and my control does not return back to the same method, so returning the value will not work.
So, is there any other way to pass the value (in my case, the result of the purchase in the application) for my C ++ class from a java function ???
Komal source share