Ejemplo n.º 1
0
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            try
            {
                Service = IInAppBillingServiceStub.AsInterface(service);

                int response = Service.IsBillingSupported(BillingConstants.ApiVersion, Application.Context.PackageName, BillingConstants.ItemTypeInApp);
                var source   = _connectSource;
                if (response == BillingConstants.ResultOk)
                {
                    if (source != null)
                    {
                        source.TrySetResult(true);
                    }
                }
                else
                {
                    if (source != null)
                    {
                        source.TrySetException(new Exception("Billing not supported!"));
                    }
                }
            }
            catch (Exception exc)
            {
                var source = _connectSource;
                if (source != null)
                {
                    source.TrySetException(exc);
                }
            }
        }
Ejemplo n.º 2
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);
        }
		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 (Constants.APIVersion, packageName, ItemType.InApp);
				if (response != BillingResult.OK) {
					SetupFinished(false);
				}

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

				// check for v3 subscriptions support
				response = Service.IsBillingSupported(Constants.APIVersion, 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);
		}
        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;
            }
        }
        public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            Service = IInAppBillingServiceStub.AsInterface (service);

            string packageName = _activity.PackageName;

            try {

                int response = Service.IsBillingSupported (Xamarin.InAppBilling.Billing.APIVersion, packageName, "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;
            }
        }