COCOS2D-X SDKBOX In-App Purchase concern

Hello, we using latest SDKBOX version and Cocos2d-x 3.8.1 C++ and we have big concern regarding in-app purchases on Android, as this procedure is not transparent for Developer.

We set analytic events for Failed and Canceled purchases and what we see that 95% of all initialized purchases failed or was canceled, which pointing to SDKBOX functionality problem.

So we need flow to test 100% that everything works and if it crashing not because SDKBOX try to use they own resources which crashes by some reason.

Please share detailed flow how it works or this really makes no REASON to use SDKBOX for it…

You can easily implement purchases, but they not working properly so you loosing your revenue… like instead of 1000$ u earn 10$ because something goes wrong on SDKBOX side and you can’t change it…

Can you show me what’s the error message when purchase fails?

There are already more than 1000 games using SDKBOX IAP. and we haven’t heard any serious problem yet.

Hi @nite

It depends how many users using this apps and how much in-app purchases there is.

I’m not sure which exactly error appear to users for whom purchase failing, maybe you can advice how to log specific to this action error, but there is most common erros we have in crashlytics -> can be related to final purchase, I can share direct links to this issues in crashlytics if needed.

Fatal Exception: java.lang.NullPointerException
       at com.sdkbox.plugin.util.iap.IabHelper.queryPurchases(IabHelper.java:874)
       at com.sdkbox.plugin.util.iap.IabHelper.queryInventory(IabHelper.java:575)
       at com.sdkbox.plugin.util.iap.IabHelper.queryInventory(IabHelper.java:553)
       at com.sdkbox.plugin.util.iap.IabHelper$3.run(IabHelper.java:648)
       at java.lang.Thread.run(Thread.java:841)



Fatal Exception: java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.
       at android.os.Parcel.readException(Parcel.java:1473)
       at android.os.Parcel.readException(Parcel.java:1419)
       at com.android.vending.billing.IInAppBillingService$Stub$Proxy.getSkuDetails(IInAppBillingService.java:251)
       at com.sdkbox.plugin.util.iap.IabHelper.querySkuDetails(IabHelper.java:983)
       at com.sdkbox.plugin.util.iap.IabHelper.queryInventory(IabHelper.java:581)
       at com.sdkbox.plugin.util.iap.IabHelper.queryInventory(IabHelper.java:553)
       at com.sdkbox.plugin.util.iap.IabHelper$3.run(IabHelper.java:648)
       at java.lang.Thread.run(Thread.java:841)




Crashed: main: SIGABRT -6  0x0000000000002811
       at tgkill(Unknown Source)
       at pthread_kill(Unknown Source)
       at raise(Unknown Source)
       at (Missing)(Unknown Source)
       at abort(Unknown Source)
       at dvmAbort(Unknown Source)
       at IndirectRefTable::get(void*) const(Unknown Source)
       at dvmDecodeIndirectRef(Thread*, _jobject*)(Unknown Source)
       at (Missing)(Unknown Source)
       at (Missing)(Unknown Source)
       at sdkbox::JNIUtils::GetJNIMethodInfo(_jobject*, char const*, char const*, _JNIEnv*)(Unknown Source)
       at void sdkbox::JNIInvoke<void>(_jobject*, char const*)(Unknown Source)
       at sdkbox::IAPProxy::requestProducts() const(Unknown Source)
       at sdkbox::IAPWrapper::nativeRefresh(std::string const&)(Unknown Source)
       at sdkbox::IAPWrapper::refresh()(Unknown Source)
       at sdkbox::IAPWrapper::init()(Unknown Source)
       at sdkbox::IAP::init()(Unknown Source)
       at GameScene::onEnter()(Unknown Source)
       at cocos2d::Node::onEnter()(Unknown Source)
       at cocos2d::Director::setNextScene()(Unknown Source)
       at cocos2d::Director::drawScene()(Unknown Source)
       at cocos2d::DisplayLinkDirector::mainLoop()(Unknown Source)
       at Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender(Unknown Source)
       at dvmPlatformInvoke(Unknown Source)
       at dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)(Unknown Source)
       at (Missing)(Unknown Source)

That looks like iap failed to load, it shouldn’t cause IAP to fail though

Can you put logs in onFailure and see what causes the failure?

https://github.com/sdkbox/sdkbox-iap-sample/blob/master/cpp/Classes/HelloWorldScene.cpp#L129

We set this let’s see how it works.

Right now looks strange, like we made new build but not uploaded it yet to store. So when we running it on mobile device and trying make purchase it showing item is not available for purchase - this due current version is not live in store.
Strange part is that this error triggers SDKBOX as onCanceled listener, I think we should get some more info in this case, instead of calling onCanceled method and getting product id.

Hi @energyy

You should submit your app first into Google Play as beta.
then create a test account in your developer profile to which the app is submitted, to test IAB’s.

If not, it goes inside the onCancelled().
It would also act so, if you are testing with an unsigned build.
We would request you to keep this as a general guideline when testing IAP’s.

Best,
Pabitra

Yes, we trying to do that way.

But it would be more informative if possible to distinct onCancel method when google play canceled request or user or some other way.

Also what we got now for errors onFailed:
Network Unreachable
Google Play IAB hasn’t been initilized.

Sure, we are on it. :smile:

the error indicates the Network Unreachable, can you confirm that your device is connected to internet while this error happens?

This errors coming from live application, in most cases users downloaded this application 5-10 minutes ago and google analytics show in real time this error, so network should exist in this case for users.

@nite @pabitrapadhy
Right now purchases stats looks really bad, like so many onCancel actions called and when they are mixed with Network Unreachable or Google Play IAB hasn’t been initilized. error it seems to bad and it is blackbox as we can’t get enough info to understand what exactly happens and what causing issue.

Maybe something gone wrong with code integration, like how many time we can call skdbox::iap::init() and when is best time to do this and use refresh(), can we somehow send debug info for each initialized purchase as string?

If purchase validation is done on sdkbox servers, is there possibility that this part failing somehow?

There is screenshot example how many cancle/failed events compared to other In-App events:

purchase validation is not released yet, so definitely should not be the issue.

Can you provide the link for your game? I can download and try it out.

Hi,

Game can be downloaded here: https://play.google.com/store/apps/details?id=com.funlab.loop&hl=en

But you will need to pass 20levels before purchase will be available, hope you will like the game :smiley:

BTW,

which Google Play services version is recommended to use with SDKBOX? We now added 7.8.0 and now most common issue is:

Thread : Crashed: main
0 libdvm.so 0x40855ed0 dvmAbort
1 libdvm.so 0x40838cbc IndirectRefTable::get(void*) const
2 libdvm.so 0x40859f6b dvmDecodeIndirectRef(Thread*, _jobject*)
3 libdvm.so 0x4085cd1f (Missing)
4 libcocos2dcpp.so 0x5d6d6191 sdkbox::IAPProxy::IAPProxy()
5 libcocos2dcpp.so 0x5d6d61dd sdkbox::IAPProxy::getInstance()
6 libcocos2dcpp.so 0x5d6d69b3 sdkbox::IAPWrapper::nativeInit(sdkbox::Json const&)
7 libcocos2dcpp.so 0x5d6d87bf sdkbox::IAPWrapper::init()
8 libcocos2dcpp.so 0x5d6d8857 sdkbox::IAP::init()
9 libcocos2dcpp.so 0x5d6b6145 GameScene::onEnter()
10 libcocos2dcpp.so 0x5d792731 cocos2d::Node::onEnter()
11 libcocos2dcpp.so 0x5d7baae3 cocos2d::Director::setNextScene()
12 libcocos2dcpp.so 0x5d7bc88b cocos2d::Director::drawScene()
13 libcocos2dcpp.so 0x5d7bc96f cocos2d::DisplayLinkDirector::mainLoop()
14 libcocos2dcpp.so 0x5d75422f Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender
15 libdvm.so 0x4082df30 dvmPlatformInvoke
16 libdvm.so 0x4085d183 dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)
17 gralloc.smdk4x12.so 0x5fdd5214 (Missing)

Hi @energyy

I am using pkg.ver 28 of google_play_services for IAP’s.
It works fine for me.

And there again

Last 30 minutes stats :frowning:
what causing issue Google Play IAB issue and is it it impacting purchases ?

I tested your game reached level 20, and made a purchase, seems like it’s working correctly.

Then I turn off the wifi and tested again, saw the “Google Play IAB” issue as expected.

Ok, so “Google Play IAB” in most cases coming from disabled wi-fi , just wondring why then Google Analytics show this events “in real time”, it means it have access to internet or it sending backlog.

Did you test if it’s in real-time? It seems it’s just caching the error and transferring it to Google Analytics whenever an internet connection is back again.

Is this error related to some country or service provider?

@pabitrapadhy
How is the plugin implemented? Does it check for the return code of bindService()?

Regarding implementation, it is SDKBOX so it blackbox.

Regarding country, service provider - I will try to check this.