@Override protected LoginPackage preLogin() throws BankException, ClientProtocolException, IOException { Urllib weblogin = new Urllib(false, true); String response = weblogin.open("https://mobil.lansforsakringar.se/lf-mobile/pages/login.faces"); Matcher matcher = reViewState.matcher(response); if (!matcher.find()) { throw new BankException(res.getText(R.string.unable_to_find).toString() + " ViewState."); } String viewState = matcher.group(1); matcher = reLoginToken.matcher(response); if (!matcher.find()) { throw new BankException(res.getText(R.string.unable_to_find).toString() + " LoginToken."); } String loginToken = matcher.group(1); List<NameValuePair> postData = new ArrayList<NameValuePair>(); postData.add(new BasicNameValuePair("login:userId", username)); postData.add(new BasicNameValuePair("login:pin", password)); postData.add(new BasicNameValuePair("login", "login")); postData.add(new BasicNameValuePair("javax.faces.ViewState", viewState)); postData.add(new BasicNameValuePair("login:time", Long.toString(System.currentTimeMillis()))); postData.add(new BasicNameValuePair("login:loginToken", loginToken)); postData.add(new BasicNameValuePair("login:loginButton", "login:loginButton")); return new LoginPackage(weblogin, postData, response, weblogin.getCurrentURI()); }