public void CheckIapAvailability() { iapClient = Iap.GetIapClient(); ITask <EnvReadyResult> task = iapClient.EnvReady; task.AddOnSuccessListener((result) => { Debug.Log("HMSP: checkIapAvailabity SUCCESS"); iapAvailable = true; OnCheckIapAvailabilitySuccess?.Invoke(); }).AddOnFailureListener((exception) => { Debug.Log("HMSP: Error on ObtainOwnedPurchases"); iapClient = null; iapAvailable = false; OnCheckIapAvailabilityFailure?.Invoke(exception); }); }
public void CheckIapAvailability() { iapClient = Iap.GetIapClient(); ITask <EnvReadyResult> task = iapClient.EnvReady; task.AddOnSuccessListener((result) => { Debug.Log("[HMSIAPManager] checkIapAvailabity SUCCESS"); iapAvailable = true; OnCheckIapAvailabilitySuccess?.Invoke(); ObtainProductInfo(HMSIAPProductListSettings.Instance.GetProductIdentifiersByType(HMSIAPProductType.Consumable), HMSIAPProductListSettings.Instance.GetProductIdentifiersByType(HMSIAPProductType.NonConsumable), HMSIAPProductListSettings.Instance.GetProductIdentifiersByType(HMSIAPProductType.Subscription)); }).AddOnFailureListener((exception) => { Debug.LogError("[HMSIAPManager]: Error on EnvReady"); IapApiException iapEx = exception.AsIapApiException(); iapEx.Status.StartResolutionForResult ( (intent) => { Debug.Log("[HMSIAPManager]: Success on iapEx Resolution"); OnCheckIapAvailabilitySuccess?.Invoke(); ObtainProductInfo(HMSIAPProductListSettings.Instance.GetProductIdentifiersByType(HMSIAPProductType.Consumable), HMSIAPProductListSettings.Instance.GetProductIdentifiersByType(HMSIAPProductType.NonConsumable), HMSIAPProductListSettings.Instance.GetProductIdentifiersByType(HMSIAPProductType.Subscription)); }, (ex) => { iapClient = null; iapAvailable = false; Debug.LogError("[HMSIAPManager]: ERROR on StartResolutionForResult: " + ex.WrappedCauseMessage + " " + ex.WrappedExceptionMessage); OnCheckIapAvailabilityFailure?.Invoke(exception); } ); }); }