/** * The {@link BillingReceiver} sends messages to this service using intents. * Each intent has an action and some extra arguments specific to that action. * @param intent the intent containing one of the supported actions * @param startId an identifier for the invocation instance of this service */ public void handleCommand(Intent intent, int startId) { string action = intent.Action; if (Consts.DEBUG) { Log.Info(TAG, "handleCommand() action: " + action); } if (Consts.ACTION_CONFIRM_NOTIFICATION.Equals(action)) { string[] notifyIds = intent.GetStringArrayExtra(Consts.NOTIFICATION_ID); Execute(new ConfirmNotifications(startId, notifyIds)); } else if (Consts.ACTION_GET_PURCHASE_INFORMATION.Equals(action)) { string notifyId = intent.GetStringExtra(Consts.NOTIFICATION_ID); Execute(new GetPurchaseInformation(startId, new string[] { notifyId })); } else if (Consts.ACTION_PURCHASE_STATE_CHANGED.Equals(action)) { string signedData = intent.GetStringExtra(Consts.INAPP_SIGNED_DATA); string signature = intent.GetStringExtra(Consts.INAPP_SIGNATURE); purchaseStateChanged(startId, signedData, signature); } else if (Consts.ACTION_RESPONSE_CODE.Equals(action)) { long requestId = intent.GetLongExtra(Consts.INAPP_REQUEST_ID, -1); int responseCodeIndex = intent.GetIntExtra(Consts.INAPP_RESPONSE_CODE, (int)Consts.ResponseCode.RESULT_ERROR); Consts.ResponseCode responseCode = (Consts.ResponseCode)responseCodeIndex; checkResponseCode(requestId, responseCode); } }
/** * This is called when we receive a response code from Android Market for a request * that we made. This is used for reporting various errors and for * acknowledging that an order was sent to the server. This is NOT used * for any purchase state changes. All purchase state changes are received * in the {@link BillingReceiver} and passed to this service, where they are * handled in {@link #purchaseStateChanged(int, string, string)}. * @param requestId a number that identifies a request, assigned at the * time the request was made to Android Market * @param responseCode a response code from Android Market to indicate the state * of the request */ private void checkResponseCode(long requestId, Consts.ResponseCode responseCode) { BillingRequest request = mSentRequests[requestId]; if (request != null) { if (Consts.DEBUG) { Log.Debug(TAG, request.GetType().Name + ": " + responseCode); } request.responseCodeReceived(responseCode); } mSentRequests.Remove(requestId); }
public override void responseCodeReceived(Consts.ResponseCode responseCode) { ResponseHandler.responseCodeReceived(this.Service, this, responseCode); }
public void onRestoreTransactionsResponse(RestoreTransactions request, Consts.ResponseCode responseCode) { Toast.MakeText(m_activity, string.Format("Restore response code: {0}", responseCode.ToString()), ToastLength.Long).Show(); }
/** * This is called when Android Market sends a response code for this * request. * @param responseCode the response code */ public virtual void responseCodeReceived(Consts.ResponseCode responseCode) { }
public void onRequestPurchaseResponse(string itemId, Consts.ResponseCode response) { throw new NotImplementedException(); }
/** * This is called when we receive a response code from Android Market for a * RestoreTransactions request. * @param context the context * @param request the RestoreTransactions request for which we received a * response code * @param responseCode a response code from Market to indicate the state * of the request */ public static void responseCodeReceived(Context context, RestoreTransactions request, Consts.ResponseCode responseCode) { if (sPurchaseObserver != null) { sPurchaseObserver.onRestoreTransactionsResponse(request, responseCode); } }