public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            Service = IInAppBillingServiceStub.AsInterface(service);
            string packageName = _activity.PackageName;

            try
            {
                int response = Service.IsBillingSupported(Billing.APIVersion, packageName, ItemType.InApp);
                if (response != BillingResult.OK)
                {
                    Connected = false;
                }

                // check for v3 subscriptions support
                response = Service.IsBillingSupported(Billing.APIVersion, packageName, ItemType.Subscription);
                if (response == BillingResult.OK)
                {
                    Connected = true;
                    RaiseOnConnected(Connected);

                    return;
                }
                else
                {
                    Connected = false;
                }
            }
            catch (Exception ex)
            {
                Connected = false;
            }
        }
Exemplo n.º 2
0
        public void DismissKeyboard()
        {
            InputMethodManager inputMethodManager = (InputMethodManager)ActivityProvider.CurrentActivity.GetSystemService(Context.InputMethodService);

            if (inputMethodManager != null)
            {
                Android.OS.IBinder token = ActivityProvider.CurrentActivity.CurrentFocus?.WindowToken;
                inputMethodManager.HideSoftInputFromWindow(token, HideSoftInputFlags.None);

                ActivityProvider.CurrentActivity.Window.DecorView.ClearFocus();
            }
        }
Exemplo n.º 3
0
        public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            LogDebug("Billing service connected.");
            Service = IInAppBillingServiceStub.AsInterface(service);

            string packageName = _context.PackageName;

            try
            {
                LogDebug("Checking for in-app billing V3 support");
                int response = Service.IsBillingSupported(19, packageName, "ReservedTestProductIDs.Purchased");
                if (response != BillingResult.OK)
                {
                    SetupFinished(false);
                }

                LogDebug("In-app billing version 3 supported for " + packageName);

                // check for v3 subscriptions support
                response = Service.IsBillingSupported(19, packageName, ItemType.Subscription);
                if (response == BillingResult.OK)
                {
                    LogDebug("Subscriptions AVAILABLE.");
                    SetupFinished(true);
                    return;
                }
                else
                {
                    LogDebug("Subscriptions NOT AVAILABLE. Response: " + response);
                }
            }
            catch (Exception ex)
            {
                LogDebug(ex.ToString());
                SetupFinished(false);
            }

            SetupFinished(false);
        }
Exemplo n.º 4
0
        public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            Logger.Debug("Billing service connected.");
            Service = IInAppBillingServiceStub.AsInterface(service);

            string packageName = _activity.PackageName;

            try {
                Logger.Debug("Checking for in-app billing V3 support");

                int response = Service.IsBillingSupported(Billing.APIVersion, packageName, ItemType.InApp);
                if (response != BillingResult.OK)
                {
                    Connected = false;
                }

                Logger.Debug("In-app billing version 3 supported for {0}", packageName);

                // check for v3 subscriptions support
                response = Service.IsBillingSupported(Billing.APIVersion, packageName, ItemType.Subscription);
                if (response == BillingResult.OK)
                {
                    Logger.Debug("Subscriptions AVAILABLE.");
                    Connected = true;
                    RaiseOnConnected(Connected);

                    return;
                }
                else
                {
                    Logger.Debug("Subscriptions NOT AVAILABLE. Response: {0}", response);
                    Connected = false;
                }
            } catch (Exception ex) {
                Logger.Debug(ex.ToString());
                Connected = false;
            }
        }