SDKBOX IAP Initialization problem on Android

Hello, I have problem with SDKBOX IAP on Android. IAP only works first time when I click the button other times I got this log message:

INF: SDKBoxIAP: refresh Products
ERR: SDKBoxIAP Can't find any IAP listener.

INF: SDKBoxIAP: Processing a previous payment.

I have created IAP listener. I have tested on iOS looks like everything works fine. But on android it works only one time. Where can be a problem? Thanks :smiley:

Can you please show me what you are doing to create the listener? I need your .cpp and .h

My header file:

class HelloWorld : public sdkbox::IAPListener {

public:    

// IAP events functions
void onSuccess(const sdkbox::Product& p);
void onFailure(const sdkbox::Product& p, const std::string& msg);
void onCanceled(const sdkbox::Product& p);
void onRestored(const sdkbox::Product& p);
void onProductRequestSuccess(const std::vector<sdkbox::Product>& products);
void onProductRequestFailure(const std::string& msg);
};

my cpp file:

// in init()
sdkbox::IAP::setListener(this);

void HelloWorld::removeAdsBtnClicked() {
    sdkbox::IAP::purchase("remove_ads");
}

// IAP events functions
void HelloWorld::onSuccess(const sdkbox::Product& p) {
CCLOG("onSuccess");
}

void HelloWorld::onFailure(const sdkbox::Product& p, const std::string& msg) {
CCLOG("onFailure");
}

void HelloWorld::onCanceled(const sdkbox::Product& p) {
CCLOG("onCanceled");
}

void HelloWorld::onRestored(const sdkbox::Product& p) {
CCLOG("onRestored");
}

void HelloWorld::onProductRequestSuccess(const std::vector<sdkbox::Product>& products) {
CCLOG("onProductRequestSuccess");
}

void HelloWorld::onProductRequestFailure(const std::string& msg) {
CCLOG("onProductRequestFailure");
}

Can you try and see if it works for you?

Hello, I think that I found bug in SDKBOX. In my game I use SDKBOX for AdColony, Chartboost, Google Analytics and IAP. In AppDelagate.cpp I call init() :

sdkbox::IAP::init();
sdkbox::PluginAdColony::init();
sdkbox::PluginChartboost::init();
sdkbox::PluginGoogleAnalytics::init();

when I comment out this lines SDKBOX IAP works fine:

    sdkbox::IAP::init();
//    sdkbox::PluginAdColony::init();
//    sdkbox::PluginChartboost::init();
//    sdkbox::PluginGoogleAnalytics::init();

And I also have tested it with brand new project if I comment out this lines SDKBOX IAP works perfectly.

@m_45 - I think we had a bug with this. Can you make sure you are using the latest plugins for each and I think that you should be fine. IIRC, we fixed this in v1.1.5.

I’am already using latest versions for all plugins.

alright, I remember @nite talking about this, so let us ask him to help here.

Interesting, we did test initialize everything with sdkbox-sample
Can you tell me your cocos2d-x version? and are you testing on ios or android?
Trying to reproduce this issue.

I’am using cocos2d-x 3.6 and this problem happens on Android.

is this problem solved coz the Listener is not working on Android form me .

what is your problem?

Listener not calling on Android.

ERR: SDKBoxIAP Can’t find any IAP listener.
Working only on iOS .

sdkbox::PluginChartboost::init();
sdkbox::PluginAdColony::init();
sdkbox::PluginVungle::init();
sdkbox::IAP::init();

if i did this it works fine

   // sdkbox::PluginChartboost::init();
   // sdkbox::PluginAdColony::init();
   // sdkbox::PluginVungle::init();
    sdkbox::IAP::init();

I’m using SDKBOX v1.2.0.1

I’ve got the same problem (IAP only works the first time when using sdkboxIAP and sdkboxAdColony).
I’m using cocos2d-x 3.3 and I’m testing on Android.

I’m still trying to reproduce this issue.
I create a trello card so you can track it’s progress

worked for me when i do it this way

sdkbox::IAP::init();
sdkbox::PluginChartboost::init();
sdkbox::PluginAdColony::init();
sdkbox::PluginAdColony::setListener(this);
sdkbox::PluginVungle::init();
sdkbox::PluginVungle::setListener(this);

i have the same problem…

Hello!

is this problem resolved yet?
I’m using on SDKBOX IAP v 1.3.0.18.
When I pressed the buy button for the first time the google play buy window showed and if I cancel or buy.
It doesn’t triggered on onSuccess or onFailed listeners. But if i call IAP:refresh() it caught in onProductRequestSuccess listeners. I see in logcat after I pressed the buy button for the second time it show this:

INF: Reading sdkbox config
INF: SDKBox IAP: creating Products list:
INF: SDKBox IAP: Processing a previous payment
INF: SDKBox

Also if I successfully buy an IAP, It doesn’t trigger the onSuccess.
After I restart the apps and bought the same item, it proceed to consume the previous successful purchase and trigger the onSuccess.
People wouldn’t know to restart the app to successfully get the IAP.

is this a bug or mistake in my code implementing the listeners?

I am not sure, let us ask @nite to help with this.

Can you show us your code?

I believe you have a different problem than what’s described in the original post(which has been fixed)

Can you provide some code that will reproduce this issue?

Can you checkout our sample and see if it works for you?
https://github.com/chukong/sdkbox-iap-sample