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;
            }
        }
Exemple #2
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);
                }
            }
        }
        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;
            }
        }
		/// <summary>
		/// Dispose of object, releasing resources. It's very important to call this
		/// method when you are done with this object. It will release any resources
		/// used by it such as service connections. Naturally, once the object is
		/// disposed of, it can't be used again.
		/// </summary>
		public void dispose()
		{
			logDebug("Disposing.");
			mSetupDone = false;
			if (mServiceConn != null)
			{
				logDebug("Unbinding from service.");
				if (mContext != null)
				{
					mContext.UnbindService(mServiceConn);
				}
			}
			mDisposed = true;
			mContext = null;
			mServiceConn = null;
			mService = null;
			mPurchaseListener = null;
		}
        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);
		}
Exemple #7
0
 public void OnServiceDisconnected(ComponentName name)
 {
     Service = null;
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JWChinese.InAppBillingHelper"/> class.
 /// </summary>
 /// <param name="activity">Activity.</param>
 /// <param name="billingService">Billing service.</param>
 public InAppBillingHelper(Activity activity, IInAppBillingService billingService)
 {
     this.billingService = billingService;
     this.activity       = activity;
 }
        public void OnServiceDisconnected(ComponentName name)
        {
            Connected = false;
            Service = null;
            BillingHelper = null;

            RaiseOnDisconnected ();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="InAppService.InAppBillingHelper"/> class.
 /// </summary>
 /// <param name="activity">Activity.</param>
 /// <param name="billingService">Billing service.</param>
 public InAppBillingHelper(Activity activity, IInAppBillingService billingService, string publicKey)
 {
     _billingService = billingService;
     _activity       = activity;
     _publicKey      = publicKey;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InAppService.InAppBillingHelper"/> class.
 /// </summary>
 /// <param name="activity">Activity.</param>
 /// <param name="billingService">Billing service.</param>
 public InAppBillingHelper(Activity activity, IInAppBillingService billingService, string publicKey)
 {
     _billingService = billingService;
     _activity = activity;
     _publicKey = publicKey;
 }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InAppService.InAppBillingHelper"/> class.
 /// </summary>
 /// <param name="activity">Activity.</param>
 /// <param name="billingService">Billing service.</param>
 public InAppBillingHelper(Activity activity, IInAppBillingService billingService)
 {
     _billingService = billingService;
     _activity       = activity;
 }
		public void OnServiceDisconnected (ComponentName name)
		{
			Service = null;
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="InAppService.InAppBillingHelper"/> class.
		/// </summary>
		/// <param name="activity">Activity.</param>
		/// <param name="billingService">Billing service.</param>
		public InAppBillingHelper (Activity activity, IInAppBillingService billingService)
		{
			_billingService = billingService;
			_activity = activity;
		}