EvilMindDevs / hms-unity-plugin

The HMS Unity Plugin makes it easy to include Huawei Mobile Services into Unity-based games. Authentication, in-app purchases, push alerts, ads, and interaction with gaming services are just a few of the basic capabilities that this formidable tool makes available to your applications.
https://evilminddevs.gitbook.io/hms-unity-plugin/
315 stars 42 forks source link

Rewarding the Player after a successful purchase #77

Closed ozan029 closed 4 years ago

ozan029 commented 4 years ago

First of all thank you for the great work with this plugin. I have a question about the IAPManager. Where in the script can i implement the reward the Player gets f.e. "No Ads" (with the productid "noads") after a successful payment? Other than that i already tried to test the IAP but when i click the button nothing appears. Does the app need to be live in the AppGallery in order to use the IAPs?

Thank you

ozan029 commented 4 years ago

this is the error log after pressing the buy button:

10-12 14:43:59.559 3911 3911 D GamePkgDataHelper: getGamePkgData(). com.xxxxx.xxxxxx.huawei 10-12 14:43:59.559 3911 3911 D CustomFrequencyManagerService: acquireDVFSLockLocked : type : DVFS_MIN_LIMIT frequency : 858000 uid : 1000 pid : 3911 pkgName : GESTURE_DETECTED@CPU_MIN@27 10-12 14:43:59.594 13386 13410 E Unity : NullReferenceException: Object reference not set to an instance of an object. 10-12 14:43:59.594 13386 13410 E Unity : at HmsPlugin.IapManager.BuyProduct (HuaweiMobileServices.IAP.ProductInfo productInfo, System.String payload) [0x00000] in <00000000000000000000000000000000>:0 10-12 14:43:59.594 13386 13410 E Unity : at UnityEngine.Events.UnityAction1[T0].Invoke (T0 arg0) [0x00000] in <00000000000000000000000000000000>:0 10-12 14:43:59.594 13386 13410 E Unity : at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <00000000000000000000000000000000>:0 10-12 14:43:59.594 13386 13410 E Unity : at UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1].Invoke (T1 handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 10-12 14:43:59.594 13386 13410 E Unity : at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00000] in <00000000000000000000000000000000>:0

ozan029 commented 4 years ago

Using the newest version of IAPDemoManager and IAPManager scripts solved the problem