public void handleCommand(Intent intent, int startId) {
   String action = intent.getAction();
   Log.i(TAG, new StringBuilder("handleCommand() action: ").append(action).toString());
   if (Consts.ACTION_CONFIRM_NOTIFICATION.equals(action)) {
     confirmNotifications(startId, intent.getStringArrayExtra(Consts.NOTIFICATION_ID));
   } else if (Consts.ACTION_GET_PURCHASE_INFORMATION.equals(action)) {
     String notifyId = intent.getStringExtra(Consts.NOTIFICATION_ID);
     getPurchaseInformation(startId, new String[] {notifyId});
   } else if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) {
     purchaseStateChanged(
         startId,
         intent.getStringExtra(Consts.INAPP_SIGNED_DATA),
         intent.getStringExtra(Consts.INAPP_SIGNATURE));
   } else if (Consts.ACTION_RESPONSE_CODE.equals(action)) {
     checkResponseCode(
         intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1),
         ResponseCode.valueOf(
             intent.getIntExtra(Consts.INAPP_RESPONSE_CODE, ResponseCode.RESULT_ERROR.ordinal())));
   }
 }
 /**
  * This is the entry point for all asynchronous messages sent from Android Market to the
  * application. This method forwards the messages on to the {@link BillingService}, which handles
  * the communication back to Android Market. The {@link BillingService} also reports state changes
  * back to the application through the {@link ResponseHandler}.
  */
 @Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) {
     String signedData = intent.getStringExtra(Consts.INAPP_SIGNED_DATA);
     String signature = intent.getStringExtra(Consts.INAPP_SIGNATURE);
     purchaseStateChanged(context, signedData, signature);
   } else if (Consts.ACTION_NOTIFY.equals(action)) {
     String notifyId = intent.getStringExtra(Consts.NOTIFICATION_ID);
     StoreUtils.LogDebug(TAG, "notifyId: " + notifyId);
     notify(context, notifyId);
   } 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, Consts.ResponseCode.RESULT_ERROR.ordinal());
     checkResponseCode(context, requestId, responseCodeIndex);
   } else {
     Log.w(TAG, "unexpected action: " + action);
   }
 }