Beispiel #1
0
        /// <summary>
        /// Executes a BillingRequest
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        bool Execute(BillingRequest request)
        {
            request.Service = this;

            if (mService != null)
            {
                try
                {
                    var requestId = request.Run(mService);
                    mSentRequests.Add(requestId, request);
                    return(true);
                }
                catch (RemoteException)
                {
                    mService = null;
                    request.OnRemoteException();
                }
            }
            else
            {
                PendingRequests.Add(request);
                return(bindToMarketBillingService());
            }

            return(false);
        }
        public long run(IMarketBillingService mService)
        {
            Bundle request = makeRequestBundle();

            addParams(request);
            Bundle response = new Bundle();

            try
            {
                response = mService.sendBillingRequest(request);
            }
            catch (NullPointerException e)
            {
                Log.Error(typeof(BillingRequest).FullName, "Known IAB bug. See: http://code.google.com/p/marketbilling/issues/detail?id=25", e);
                return(IGNORE_REQUEST_ID);
            }

            if (validateResponse(response))
            {
                processOkResponse(response);
                return(response.GetLong(KEY_REQUEST_ID, IGNORE_REQUEST_ID));
            }
            else
            {
                return(IGNORE_REQUEST_ID);
            }
        }
Beispiel #3
0
 /**
  * This is called when we are connected to the MarketBillingService.
  * This runs in the main UI thread.
  */
 public void OnServiceConnected(ComponentName name, IBinder service)
 {
     if (Consts.DEBUG)
     {
         Log.Debug(TAG, "Billing service connected");
     }
     mService = BillingServiceStub.AsInterface(service);
     runPendingRequests();
 }
Beispiel #4
0
		/**
		 * This is called when we are disconnected from the MarketBillingService.
		 */
		public void OnServiceDisconnected(ComponentName name)
		{
			Log.Warn(TAG, "Billing service disconnected");
			mService = null;
		}
Beispiel #5
0
		/**
		 * This is called when we are connected to the MarketBillingService.
		 * This runs in the main UI thread.
		 */
		public void OnServiceConnected(ComponentName name, IBinder service)
		{
			if (Consts.DEBUG)
			{
				Log.Debug(TAG, "Billing service connected");
			}
			mService = BillingServiceStub.AsInterface(service);
			runPendingRequests();
		}
Beispiel #6
0
		/// <summary>
		/// Executes a BillingRequest
		/// </summary>
		/// <param name="request"></param>
		/// <returns></returns>
		bool Execute(BillingRequest request)
		{
			request.Service = this;

			if (mService != null)
			{
				try
				{
					var requestId = request.Run(mService);
					mSentRequests.Add(requestId, request);
					return true;
				}
				catch (RemoteException)
				{
					mService = null;
					request.OnRemoteException();
				}
			}
			else
			{
				PendingRequests.Add(request);
				return bindToMarketBillingService();
			}

			return false;
		}		
 public void OnServiceDisconnected(ComponentName name)
 {
     mService = null;
 }
 public void OnServiceConnected(ComponentName name, IBinder service)
 {
     mService = new BillingService() as IMarketBillingService;
     runPendingRequests();
 }
 public void OnServiceDisconnected(ComponentName name)
 {
     mService = null;
 }
 public void OnServiceConnected(ComponentName name, IBinder service)
 {
     mService = new BillingService() as IMarketBillingService;
     runPendingRequests();
 }
Beispiel #11
0
 /**
  * This is called when we are disconnected from the MarketBillingService.
  */
 public void OnServiceDisconnected(ComponentName name)
 {
     Log.Warn(TAG, "Billing service disconnected");
     mService = null;
 }