Comments (7)
I faced a similar issue;
I can retrieve all products there is no issue. But when I triggered BuyProduct function like below;
public void Buy(ProductLineComp productLineComp)
{
var product = productLineComp.GetProduct();
PurchaseIntentReq purchaseIntentReq = new PurchaseIntentReq
{
PriceType = 0,
ProductId = product.id,
DeveloperPayload = "dev"
};
ITask<PurchaseIntentResult> task = _iapClient.CreatePurchaseIntent(purchaseIntentReq);
task.AddOnSuccessListener((intentResult)=>
{
if (intentResult != null)
{
Debug.Log("[HMSPlugin]:" + intentResult.ErrMsg + intentResult.ReturnCode.ToString());
Debug.Log("[HMSPlugin]: Bought " + purchaseIntentReq.ProductId);
Status status = intentResult.Status;
status.StartResolutionForResult((androidIntent) =>
{
PurchaseResultInfo purchaseResultInfo = _iapClient.ParsePurchaseResultInfoFromIntent(androidIntent);
Debug.Log("HMSPluginResult: " + purchaseResultInfo.ReturnCode);
Debug.Log("HMErrorMssg: " + purchaseResultInfo.ErrMsg);
Debug.Log("HMS: HMSInAppPurchaseData" + purchaseResultInfo.InAppPurchaseData);
Debug.Log("HMS: HMSInAppDataSignature" + purchaseResultInfo.InAppDataSignature);
switch (purchaseResultInfo.ReturnCode)
{
case OrderStatusCode.ORDER_STATE_SUCCESS:
_listener.OnPurchaseSuccess(product.id);
break;
default:
Debug.Log("[HMSPlugin]:startIntent ERROR");
break;
}
}, (exception) =>
{
Debug.Log("[HMSPlugin]:startIntent ERROR");
});
}
});
task.AddOnFailureListener((exception) =>
{
Debug.Log("[HMSPlugin]:startIntent ERROR: " + exception.Message);
});
}
It throws an exception;
07-06 20:13:44.753: E/Unity(27131): MissingMethodException: Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found.
07-06 20:13:44.753: E/Unity(27131): at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at HuaweiMobileServices.Utils.AndroidJavaObjectExtensions.AsWrapper[T] (UnityEngine.AndroidJavaObject javaObject) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at System.Func`2[T,TResult].Invoke (T arg) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at HuaweiMobileServices.Base.OnSuccessListenerConve
07-06 20:13:45.270: E/hms_pay(8474): StateCoupon coupons parseJsonObject jsonObject returnCode is not success.
My Unity Version is: 2019.3.6f1
HMS Unity Plugin Version is v1.1.2
from hms-unity-plugin.
After using the latest version. I managed to make it work, I get all the respective events I needed while doing a purchase and after a purchase.
from hms-unity-plugin.
HMS version 1.1.2
Unity 2019.3.15f1
Having same issue when buyProduct MissingMethodException:Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found
2020/07/23 11:04:45.727 9463 9463 Error Unity MissingMethodException: Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found as above
from hms-unity-plugin.
all purchases from the developer console are initialized, but when you click on the buy button, the purchase window does not appear, iapClient.CreatePurchaseIntent (purchaseIntentReq) -> does not work
HMS версия 1.1.2
Unity 2019.2.14f1
from hms-unity-plugin.
We are having the same issue. Inside IapManager.cs, when we call:
ITask<PurchaseIntentResult> task = iapClient.CreatePurchaseIntent(purchaseIntentReq);
we get the following error in logcat:
07-24 11:30:06.332 16567 16567 E Unity : MissingMethodException: Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found. 07-24 11:30:06.332 16567 16567 E Unity : at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0 07-24 11:30:06.332 16567 16567 E Unity : at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <00000000000000000000000000000000>:0 07-24 11:30:06.332 16567 16567 E Unity : at HuaweiMobileServices.Utils.AndroidJavaObjectExtensions.AsWrapper[T] (UnityEngine.AndroidJavaObject javaObject) [0x00000] in <00000000000000000000000000000000>:0 07-24 11:30:06.332 16567 16567 E Unity : at System.Func
2[T,TResult].Invoke (T arg) [0x00000] in <00000000000000000000000000000000>:0
07-24 11:30:06.332 16567 16567 E Unity : at HuaweiMobileServices.Base.OnSuccessListenerConve`
HMS version 1.1.2
Unity 2019.3.14f1
Edit: We have downloaded the dll project from https://github.com/m0skit0/hms-sdk-unity/tree/master/hms-sdk-unity to generate the release version of the HuaweiMobileServices.dll and we have replaced the one that comes with the plugin. Now the error is gone
from hms-unity-plugin.
Thanks @robroy07 , we will update the plugin with the correct DLL asap.
from hms-unity-plugin.
Updated with latest SDK DLL in commit aea9a72
from hms-unity-plugin.
Related Issues (20)
- ADS Not Working in HMS 2.3.4 Unity HOT 5
- Errors during build HOT 3
- 调用SilentSignIn登录返回错误码7400 HOT 2
- This is a test HOT 2
- Help with consent HOT 8
- Developer payload cannot be passed thru PurchaseProduct method HOT 7
- Consumption of purchases in InitializeIAP should be optional HOT 6
- 3.2.5 Version on 2020 Unity version is not compling HOT 5
- 请问有没有要使用这个插件接入华为的防沉迷功能应该怎么做? HOT 15
- HMS Unity not working , create run time error (v2.3.5 - Unity 2019/2020/2021) HOT 12
- Disable 'update plugin' process on consoles HOT 3
- Ads not showing in Unity 2022.2.13 HOT 3
- About App-Ads.txt HOT 5
- How to make build on Harmony OS ? HOT 10
- Huawei Unity IAP Did Not Worked. HOT 9
- App force update HOT 13
- The type or namespace name 'HmsPlugin' could not be found HOT 3
- Assets/Huawei/Plugins/Android/hmsMainTemplate.gradle is absent HOT 3
- This is a test HOT 2
- Issue installing Huawei Android dependencies HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hms-unity-plugin.