void CreateClient()
        {
            this.iapClient = Iap.GetIapClient();
            var moduleInitTask = iapClient.EnvReady;

            moduleInitTask.AddOnSuccessListener(ClientinitSuccess).AddOnFailureListener(ClientInitFailed);
        }
Beispiel #2
0
        private void QueryIsReady()
        {
            Log.Info(TAG, "IsReady");
            IIapClient mClient    = Iap.GetIapClient(this);
            Task       isEnvReady = mClient.IsEnvReady();

            isEnvReady.AddOnSuccessListener(new ListenerImp()).AddOnFailureListener(new ListenerImp());
        }
Beispiel #3
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     Xamarin.Essentials.Platform.Init(this, savedInstanceState);
     SetContentView(Resource.Layout.activity_non_consumption);
     mClient = Iap.GetIapClient(this);
     InitView();
     QueryPurchases(null);
 }
Beispiel #4
0
 public static IIapClient GetIapClient()
 {
     if (sIapClient == null)
     {
         AndroidJavaObject iapClient = sIapClass.CallStatic <AndroidJavaObject>("getIapClient", AndroidContext.ActivityContext);
         sIapClient = new IapClientWrapper(iapClient);
     }
     return(sIapClient);
 }
Beispiel #5
0
        void CreateClient()
        {
            this.iapClient = Iap.GetIapClient();
            var moduleInitTask = iapClient.EnvReady;

            Debug.Log("UnityIapProvider - HuaweiStore iapClient is created!");

            moduleInitTask.AddOnSuccessListener(ClientinitSuccess).AddOnFailureListener(ClientInitFailed);
        }
        private void QueryHistoryInterface()
        {
            IIapClient        iapClient = Iap.GetIapClient(this);
            OwnedPurchasesReq req       = new OwnedPurchasesReq();

            req.PriceType         = IapClientPriceType.InAppConsumable;
            req.ContinuationToken = continuationToken;
            iapClient.ObtainOwnedPurchaseRecord(req).AddOnSuccessListener(new ObtainListenerImp(this)).AddOnFailureListener(new ObtainListenerImp(this));
        }
        private void ConsumeOwnedPurchase(IIapClient iapClient, String purchaseToken)
        {
            ConsumeOwnedPurchaseReq req = new ConsumeOwnedPurchaseReq();

            req.PurchaseToken = purchaseToken;

            Log.Info(TAG, "call consumeOwnedPurchase");
            Task task = iapClient.ConsumeOwnedPurchase(req);

            task.AddOnSuccessListener(new ConsumListenerImp()).AddOnFailureListener(new ConsumListenerImp());
        }
Beispiel #8
0
    private void checkIapAvailabity()
    {
        iapClient = Iap.GetIapClient();

        ITask <EnvReadyResult> task = iapClient.EnvReady;

        task.AddOnSuccessListener((result) =>
        {
            Debug.Log("HMSP: checkIapAvailabity SUCCESS");
            InitIAP();
        }).AddOnFailureListener((exception) =>
        {
            Debug.Log("HMSP: Error on ObtainOwnedPurchases");

            if (IapApiExceptionUtils.IsIapApiException(exception))
            {
                IapApiException iapApiException = IapApiExceptionUtils.AsIapApiException((exception));


                Status status = iapApiException.Status;
                if (status.StatusCode == OrderStatusCode.ORDER_HWID_NOT_LOGIN)
                {
                    // User not logged in
                    if (status.HasResolution())
                    {
                        status.StartResolutionForResult((androidIntent) =>
                        {
                            Debug.Log("[HMS]: IAP login intent launched");
                            ITask <AuthHuaweiId> authTask = HuaweiIdAuthManager.ParseAuthResultFromIntent(androidIntent);

                            authTask.AddOnSuccessListener((result) =>
                            {
                                Debug.Log("[HMS]: IAP logged in user:"******"[HMS]: IAP user not logged:" + authException.Message);
                            });
                        }, (statusException) =>
                        {
                            Debug.Log("[HMS]: IAP login intent ERROR");
                        });
                    }
                }
                else if (status.StatusCode == OrderStatusCode.ORDER_ACCOUNT_AREA_NOT_SUPPORTED)
                {
                    // The current region does not support HUAWEI IAP.
                    Debug.Log("[HMS]: USer Area not supported by Huawei IAP");
                }
            }
        });
    }
        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);
                }
                );
            });
        }
 public SubscriptionPresenter(SubscriptionContract.View view)
 {
     SetView(view);
     mClient = Iap.GetIapClient(view.GetActivity());
 }