Giter Site home page Giter Site logo

Comments (11)

jmercado86 avatar jmercado86 commented on June 8, 2024 1

How was this solved? Please share. Thank you!

from hms-unity-plugin.

AndresCuicui avatar AndresCuicui commented on June 8, 2024 1

How was this solved? Please share. Thank you!

Had to uncomment the contents of ShopItem.cs and ShopManager.cs files. Just select all and uncomment once (just once because there are some other functions that can still remain commented, SetNoAds and SetPremium that I'm not using). Then, changed the IapManager references to IapDemoManager inside ShopManager.cs and ShopItem.cs just to make it compile. So far it should at least compile.
In order to make the build, you have to set the correct reference to the scripts within the scene (they may be missing). The Shop prefab is the one with the ShopManager.cs and all the ProductN are the ones with the ShopItem.cs. Then you have to set the productID for each product (I just tried with one product) to the ones you set up in your huawei console.
And then you'll want to debug the ProductInfoList and check it's not empty when calling the BuyProduct function inside IapDemoManager.cs. I had to add some safety checks because it crashed without them.
In my case, the ProductInfoList didn't get populated after the first login at the Start function of the IapDemoManager.cs. I believe it was because the login failed and the LoadStore didn't get called or something. It required a manual Sign In button press to load the product data into the ProductInfoList.
Hope it helps.

[edit] And of course, set the build number higher than the build number of the apk currently in the store (if you have one). Otherwise the sandbox mode won't be triggered with the test accounts and the app will try to make real purchases instead of test ones.

from hms-unity-plugin.

JariHuomo avatar JariHuomo commented on June 8, 2024 1

Would be great if someone would fix the IAP demo.

from hms-unity-plugin.

m0skit0 avatar m0skit0 commented on June 8, 2024

I will reopen this because it is valuable information for us to fix the demos. Thanks a lot for the feedback!

from hms-unity-plugin.

starmindfr avatar starmindfr commented on June 8, 2024

seem still broken, i see in red

ProductInfo productInfo = iapManager.GetProductInfo(productID);

inside Shopitem.cs as this method dont exist in IAPManager

from hms-unity-plugin.

toycantando avatar toycantando commented on June 8, 2024

the demo still without working, for some reason the authentication manager is not called. and the iapManager still empty.

from hms-unity-plugin.

starmindfr avatar starmindfr commented on June 8, 2024

yes you have lots of extra works uncomenting samples codes and adding one controler script. so 90 % of code is in, the 10% is not difficult to get on tutorials try google. but it would be great to have it fixed here.

from hms-unity-plugin.

AndresCuicui avatar AndresCuicui commented on June 8, 2024

For those of you having trouble, all IapManager references should be changed to IapDemoManager (IapManager should not be used anymore on this demo).

from hms-unity-plugin.

toycantando avatar toycantando commented on June 8, 2024

I update the project with the last unity.package, and the follow line of code inside the AccountManager.cs does not work:

authService = DefaultAuthService;

this is the error:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine._AndroidJNIHelper.GetSignature (System.Object obj) (at /Users/builduser/buildslave/unity/build/Modules/AndroidJNI/AndroidJava.cs:1510)
UnityEngine._AndroidJNIHelper.GetSignature (System.Object[] args) (at /Users/builduser/buildslave/unity/build/Modules/AndroidJNI/AndroidJava.cs:1537)
UnityEngine._AndroidJNIHelper.GetConstructorID (System.IntPtr jclass, System.Object[] args) (at /Users/builduser/buildslave/unity/build/Modules/AndroidJNI/AndroidJava.cs:1343)
UnityEngine.AndroidJNIHelper.GetConstructorID (System.IntPtr jclass, System.Object[] args) (at /Users/builduser/buildslave/unity/build/Modules/AndroidJNI/AndroidJNI.bindings.cs:134)
UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Object[] args) (at /Users/builduser/buildslave/unity/build/Modules/AndroidJNI/AndroidJava.cs:356)
UnityEngine.AndroidJavaObject..ctor (System.String className, System.Object[] args) (at /Users/builduser/buildslave/unity/build/Modules/AndroidJNI/AndroidJava.cs:217)
HuaweiMobileServices.Utils.JavaObjectWrapper..ctor (System.String javaObjectCanonicalName, System.Object[] args) (at <48d7bb68e1d14c9893e6fd7c425224d3>:0)
HuaweiMobileServices.Id.Scope..ctor (System.String uri) (at <48d7bb68e1d14c9893e6fd7c425224d3>:0)
HuaweiMobileServices.Id.HuaweiIdAuthParams..cctor () (at <48d7bb68e1d14c9893e6fd7c425224d3>:0)
Rethrow as TypeInitializationException: The type initializer for 'HuaweiMobileServices.Id.HuaweiIdAuthParams' threw an exception.
HmsPlugin.AccountManager.OnEnable () (at Assets/Huawei/Scripts/Account/AccountManager.cs:36)
UnityEngine.GameObject:SetActive(Boolean)
MenuManager:ShowCurrencyShop() (at Assets/RaccoonRescue/Scripts/GUI/Menu/MenuManager.cs:96)
AnimationManager:BuyGems() (at Assets/RaccoonRescue/Scripts/GUI/AnimationManager.cs:218)
UnityEngine.EventSystems.EventSystem:Update() (at /Applications/Unity/Hub/Editor/2019.2.21f1/Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

from hms-unity-plugin.

AndresCuicui avatar AndresCuicui commented on June 8, 2024

According to the error message, it looks like there was an error during HuaweiMobileServices initialization.
Rethrow as TypeInitializationException: The type initializer for 'HuaweiMobileServices.Id.HuaweiIdAuthParams' threw an exception.
Therefore, DefaultAuthService was probably null and you get the null reference exception. I recomend checking wether the initialization was correct or not. Toss a try/catch surrounding the initialization, just to see what happened.

from hms-unity-plugin.

sametguzeldev avatar sametguzeldev commented on June 8, 2024

IAP Demo re-designed and it is working.

from hms-unity-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.