-
MoseHasLikes 0Problem Description
Hi there.
My iab function has finished almost 50%. However, I faced an awkward situation.
After I click the button it will run onBuy(). But when I call it,
JniHelper::getMethodInfo(methodInfo, "com/grieve/integratelogin/GoogleInAppBilling", "purchase", "(Ljava/lang/String;Ljava/lang/String;)I"); jstring jitemId = methodInfo.env->NewStringUTF("chips_10");//product id jstring jaccId = methodInfo.env->NewStringUTF("DebugHacks");//a signature for identification log("set jstrings done"); //initialize jvalue jvalue *args = new jvalue[2]; args[0].l = jitemId; args[1].l = jaccId; retI = methodInfo.env->CallIntMethodA(IAB_object, methodInfo.methodID, args);
the iab dialog will pop out. However, my onBuy() is still running down to the bottom before I enter my password and successfully buy item. Undoubtedly, the first click will do nothing, and only when the second click is activated the bought currency will be stored. I am now thinking how to fix this problem.
I know that Java has a method called onActivityResult which provides the successfully buy return value, but I don’t know if cocos2d-x has the similar function or how to do it.
Thanks.
-
Sonar Systems adminLikes 0
Are you using your own implementation for IAP or someone elses?
-
MoseHasLikes 0
Yes, my colleage has written his SDK in JAVA. I just use JniHelper to connect to it.
Basically his SDK has no problem. But problems occur when cocos2d-x is involved in.
-
Sonar Systems adminLikes 0
Are you having a problem with the wrapper side?
-
MoseHasLikes 1
Finally I succeeded.
I missed extern “C”in the header which JAVA tried to call using JniHelper.
This reply has been verified.
-
Sonar Systems adminLikes 0
Great to hear you have overcome the problem.
This reply has been verified.
-
MoseHasLikes 0
Still looking forward to Sonar solution.
Communicating with JAVA using JniHelper is really killing me.
Login to reply