Hello @chuoihottieu, are you certain you haven’t modified anything in your replace? Out of your logs it’s exhausting to say what’s going on.
@bluewind00 Thanks for sharing, it’s a superb “base” for the long run enhancements. Please make it public once more
Thanks.
I make it public the repository once more.
Once more, this can be a pattern and isn’t assured to work.
2 Likes
hello @kds @bluewind00
i change sdkbox::IAP with mingos::IAP comply with the directions, it’s work perfert on system assist native arm64-v8a, however crash on armeabi-v7a with out motive.
for instance Samsung Galaxy A13 5G: ABI assist: armeabi-v7a, armeabi.
In any case thanks you guys atleast i upgraded to billing v4 earlier than 1.11.2022!
chuoihottieu
Simply change
PROP_APP_ABI=arm64-v8a
with
PROP_APP_ABI=armeabi-v7a:arm64-v8a
in ‘proj.androidgradle.properties’
bluewind00, thanks very a lot lots (you’re our hero); I’ve up to date your code a bit, to get amount of bought merchandise; it really works even on Android 4.4.2. (debug and launch)
…Now I’ll attempt to insert it into my mission (appears not really easy).
These are information that may be copied straight into your mission.
C++:
Lessons/widespread/JsonParser.cpp
Lessons/widespread/JsonParser.h
Lessons/dropbox/json11/json11.cpp
Lessons/dropbox/json11/json11.hpp
Lessons/iap/MingosIAP.h
Lessons/platform/android/Java_iap_PurchaseEventListener.cpp
Lessons/platform/android/MingosIAP.cpp
Java:
proj.android/app/src/iap/Product.java
proj.android/app/src/iap/PurchaseEventListener.java
proj.android/app/src/iap/PurchaseManager.java
Subsequent is a set of information that will battle together with your mission’s code.
Please incorporate the required components of your mission.
proj.android/app/src/org/cocos2dx/cpp/AppActivity.java
proj.android/construct.gradle
proj.android/app/construct.gradle
proj.android/app/proguard-rules.professional
2 Likes
After two days of crashes and black screens, finally appears I used you code. It was exhausting (for me), as a result of:
- I used separate object (in my c++ code):
sdkbox::IAP::setListener(m_IAP_obj); // m_IAP_obj class extends : sdkbox::IAPListener
And you utilize the principle class for the listener (object) :
class SampleScene : public cocos2d::Scene, public mingos::IAPEventListener { // your code
class HelloWorld : public cocos2d::Layer // my previous code
- Additionally there are tiny distinction in:
proj.androidappsrcorgcocos2dxcppAppActivity.java
:
public class AppActivity extends Cocos2dxActivity { // your code
public class AppActivity extends com.sdkbox.plugin.SDKBoxActivity { // my code
…
mPurchaseManager = new PurchaseManager(this); // is it attainable to alter this file to make use of as listener not AppActivity class (object), however one thing else?
Thanks to your nice job! Because of you, possibly our Cocos video games shall be alive for some extra time.
1 Like
It is a essential level, however as a way to create your individual buy course of, you should depart the sdkbox.
This implies making use of the next code to AppActivity.
public class AppActivity extends Cocos2dxActivity {
In the event you apply my code as it’s under, you’ll not obtain the notification after the acquisition request with my code.
It is because SDKBoxActivity will obtain the results of the method from the shop.
public class AppActivity extends com.sdkbox.plugin.SDKBoxActivity
In different phrases, leaving the code above isn’t an choice for us.
mPurchaseManager = new PurchaseManager(this); // is it attainable to alter this file to make use of as listener not AppActivity class (object), however one thing else?
Are you saying you need to reduce modifications to AppActivity?
Then you are able to do that by making PurcahaseManager a singleton.
If the intent of this query is to maintain the next code as defined earlier, it is mindless.
public class AppActivity extends com.sdkbox.plugin.SDKBoxActivity
I’ve modified PurcahseManager to singleton in my newest code.
1 Like
Hello @bluewind00 ,
Thanks to your nice job. You’ve saved my mission
For individuals who get mingos::IAP to work by putting in the sport from Android Studio, however it crashes if you happen to set up it from APK… DON’T FORGET TO ADD THESE LINES TO YOUR proguard-rules.professional:
-keep class iap.** { ; }
-dontwarn iap.*
1 Like
simply replace not too long ago considered one of my video games to billing library 4, with this pattern and it’s working nice.
the one odd factor, is that generally I get these crashes:
Crashed: Thread: SIGSEGV 0x0000000000000000
#00 laptop 0x175f30 (std::__ndk1::__function::__func<Java_iap_PurchaseEventListener_onInitialized::$_1, std::__ndk1::allocator<Java_iap_PurchaseEventListener_onInitialized::$_1>, void ()>::operator()() [Java_iap_PurchaseEventListener.cpp:76])
#01 laptop 0x40ec34 (cocos2d::Scheduler::replace(float) [functional:1867])
#02 laptop 0x3f7d0c (cocos2d::Director::drawScene() [CCDirector.cpp:264])
#03 laptop 0x3fa14c (cocos2d::Director::mainLoop() [CCDirector.cpp:1392])
line 76 is:
listener->onInitialized(success);
unsure if we should always add a attempt catch there for the case of the listener not being current anymore…
or possibly its one thing else. any concepts?
I’m very grateful to your generosity in releasing this code. Does anybody have any ideas on one of the simplest ways to utilize it inside a lua-based app?
I’m considering both hack the lua wrappers which are equipped with sdkbox, or create a substitute sdkbox:IAP class that calls into this new code the place attainable and stubs something that isn’t supported. I’m uncertain what’s greatest although, so interested by what others with extra expertise with Android assume.
Hmmm, I’m clearly not as sensible as I hoped I used to be! I’m struggling to grasp learn how to make use of this in an present cocos2d-x mission, of both kind – cpp or lua. I imagined if I stared on the directions for lengthy sufficient that it will grow to be clear, however it’s not taking place. This seems to be to be a standalone pattern. So, is there a simple solution to decide precisely which information should be copied into an present mission and which information throughout the present mission want tweaking?
Sorry, ignore me: I can now see that extra detailed directions seem on this thread.
sdkbox’s implementation doesn’t appear to incorporate an acknowledge
technique. Is that as a result of acknowledging was dealt with routinely internally to the library? With the brand new code, can we now have to acknowledge purchaces?