title: monitor web browser programmatically in Android?
body: <p>I've got a tricky question here. I need users to make a payment to a bank (namely Barclaycard) in UK. To do so, I have a https URL , I add the parameters (such as amount to pay, order reference, etc) to the URL, start this http connection as an Intent.ActionView, which will redirect the user to the browser where he can enter his credit card details on the bank's webpage and make the payment to our account successfully. So far so good ?</p>
  
  <p>The code I use is below (I changed values for privacy reasons) The problem is, I need to get back to the app when the user has completed/failed/cancelled the payment. Barclaycardautomatically redirects to a particular URL when the payment has succeeded, another one if it failed. Is there no way of knowing when Barclaycard payment has succeeded so that then I would go back to the android app somehow ?</p>
  
  <pre><code>Button cardbutton = (Button) findViewById(R.id.card_button);
  cardbutton.setOnClickListener(new View.OnClickListener()
  {
      @Override
      public void onClick(View arg0)
      {
          String preHashString = new String();
          String proHashString = new String();
          String SHAPassPhrase = new String();
  
          SHAPassPhrase = "GSvTh£h70ZkHdAq9b"; // FOR TEST ENVIRONMENT
  
          preHashString = preHashString + "AMOUNT=" + String.valueOf((int) (order.getPaymentAmount() * 100.00)) + SHAPassPhrase;
          preHashString = preHashString + "BGCOLOR=cccccc" + SHAPassPhrase;
          preHashString = preHashString + "CN=" + user.getString("name") + SHAPassPhrase;
          preHashString = preHashString + "CURRENCY=GBP" + SHAPassPhrase;
          preHashString = preHashString + "LANGUAGE=en_US" + SHAPassPhrase;
          preHashString = preHashString + "ORDERID=" + order.getOrderId() + SHAPassPhrase;
  
          try
          {
              proHashString = SHA1(preHashString);
          }
          catch (NoSuchAlgorithmException e)
          {
              e.printStackTrace();
          }
          catch (UnsupportedEncodingException e)
          {
              e.printStackTrace();
          }
  
          String redirecturl = "https://mdepayments.epdq.co.uk/ncol/test/orderstandard.asp";
  
          redirecturl += "?AMOUNT=" + String.valueOf((int) (order.getPaymentAmount() * 100));
          redirecturl += "&amp;CN=" + user.getString("name");
          redirecturl += "&amp;CURRENCY=GBP";
          redirecturl += "&amp;LANGUAGE=en_US";
          redirecturl += "&amp;ORDERID=" + order.getOrderId();
          redirecturl += "&amp;SHASIGN=" + proHashString;
  
          Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(redirecturl));
          startActivity(i);
      }
  });
  </code></pre>