monitor web browser programmatically in Android? -
i've got tricky question here. need users make payment bank (namely barclaycard) in uk. so, have https url , add parameters (such amount pay, order reference, etc) url, start http connection intent.actionview, redirect user browser can enter credit card details on bank's webpage , make payment our account successfully. far ?
the code use below (i changed values privacy reasons) problem is, need app when user has completed/failed/cancelled payment. barclaycardautomatically redirects particular url when payment has succeeded, 1 if failed. there no way of knowing when barclaycard payment has succeeded go android app somehow ?
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"; // 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 += "&cn=" + user.getstring("name"); redirecturl += "¤cy=gbp"; redirecturl += "&language=en_us"; redirecturl += "&orderid=" + order.getorderid(); redirecturl += "&shasign=" + prohashstring; intent = new intent(intent.action_view, uri.parse(redirecturl)); startactivity(i); } });
you can have own webview in place inside app, done / close button somewhere.. can track urls getting open in webview , stuff accordingly..user stay in app always..that solves purpose..
for tracking urls inside webview need register 1 webviewclient , ovveride below function
public boolean shouldoverrideurlloading (webview view, string url)
have @ webview here , webviewclient here
Comments
Post a Comment