Esempio n. 1
0
		public override long Run(com.android.vending.billing.IMarketBillingService service)
		{
            Bundle request = makeRequestBundle("REQUEST_PURCHASE");
            request.PutString(Consts.BILLING_REQUEST_ITEM_ID, mProductId);
            request.PutString(Consts.BILLING_REQUEST_ITEM_TYPE, mProductType);
            // Note that the developer payload is optional.
            if (mDeveloperPayload != null) {
                request.PutString(Consts.BILLING_REQUEST_DEVELOPER_PAYLOAD, mDeveloperPayload);
            }

            Bundle response = service.SendBillingRequest(request);
						
            PendingIntent pendingIntent
                    = response.GetParcelable(Consts.BILLING_RESPONSE_PURCHASE_INTENT) as PendingIntent;
            
			if (pendingIntent == null) 
			{
                Log.Error("BillingService", "Error with requestPurchase");
                return Consts.BILLING_RESPONSE_INVALID_REQUEST_ID;
            }

            Intent intent = new Intent();
            ResponseHandler.buyPageIntentResponse(pendingIntent, intent);
            return response.GetLong(Consts.BILLING_RESPONSE_REQUEST_ID,
                    Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
        }
		public override long Run(com.android.vending.billing.IMarketBillingService service)
		{
            Bundle request = makeRequestBundle("CONFIRM_NOTIFICATIONS");
            request.PutStringArray(Consts.BILLING_REQUEST_NOTIFY_IDS, mNotifyIds);
			Bundle response = service.SendBillingRequest(request);
            logResponseCode("confirmNotifications", response);
            return response.GetLong(Consts.BILLING_RESPONSE_REQUEST_ID,
                    Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
        }
        public override long Run(com.android.vending.billing.IMarketBillingService service)
		{
            mNonce = Security.generateNonce();

            Bundle request = makeRequestBundle("RESTORE_TRANSACTIONS");
            request.PutLong(Consts.BILLING_REQUEST_NONCE, mNonce);
            Bundle response = service.SendBillingRequest(request);
            logResponseCode("restoreTransactions", response);
            return response.GetLong(Consts.BILLING_RESPONSE_REQUEST_ID,
                    Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
        }
		public override long Run(com.android.vending.billing.IMarketBillingService service)
		{
            mNonce = Security.generateNonce();

            Bundle request = makeRequestBundle("GET_PURCHASE_INFORMATION");
            request.PutLong(Consts.BILLING_REQUEST_NONCE, mNonce);
            request.PutStringArray(Consts.BILLING_REQUEST_NOTIFY_IDS, mNotifyIds);
            Bundle response = service.SendBillingRequest(request);
            logResponseCode("getPurchaseInformation", response);
            return response.GetLong(Consts.BILLING_RESPONSE_REQUEST_ID,
                    Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
        }
		public override long Run(com.android.vending.billing.IMarketBillingService service) 
		{
            Bundle request = makeRequestBundle("CHECK_BILLING_SUPPORTED");

			if (mItemType != null)
				request.PutString(Consts.BILLING_REQUEST_ITEM_TYPE, mItemType);
			
            Bundle response = service.SendBillingRequest(request);
            int responseCode = response.GetInt(Consts.BILLING_RESPONSE_RESPONSE_CODE);
            
			if (Consts.DEBUG) 
                Log.Info("BillingService", "CheckBillingSupported response code: " + responseCode.ToString());
                        
			bool billingSupported = (responseCode == (int)Consts.ResponseCode.RESULT_OK);
            ResponseHandler.checkBillingSupportedResponse(billingSupported);
            return Consts.BILLING_RESPONSE_INVALID_REQUEST_ID;
        }