At some point in my app, the payout occurs, and for that I open a page in a webview, responsible for that service (passing the data of the card by GET). When the page finishes processing, its title changes with the status of the operation, and so I get to work on android (yes, it's a gambiarra). The problem is that my client's mobile does not run, android 5.1.1. The payment is processed until the application crashes. I installed API 22, referring to android 5.1, created the emulator in android studio and everything went well. With API 23 it also works on the emulator and on my cell phone.
Could anyone help me?
Follow the webview module
private void iniciaPagamentoCartao(String url, final Agenda agenda) { //1==cartao, 2==boleto
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onLoadResource (WebView view, String url) {
if (progressDialogPagamentoCartao == null) {
progressDialogPagamentoCartao = ProgressDialog.show(act_principal.this,"Processando pagamento","Aguarde...",false,false);
}
}
public void onPageFinished(final WebView view, String url) {
public void onFinish() {
String tituloPagina = webView.getTitle().toString();
switch(tituloPagina)
{
case "Erro contate o administrador":
progressDialogPagamentoCartao.dismiss();
progressDialogPagamentoCartao = null;
Toast.makeText(act_principal.this, "Erro interno. Contate o administrador!", Toast.LENGTH_LONG).show();
break;
case "Erro no cartao de credito":
progressDialogPagamentoCartao.dismiss();
progressDialogPagamentoCartao = null;
Toast.makeText(act_principal.this, "Erro no cartão de crédito!", Toast.LENGTH_LONG).show();
break;
default:
//faz as outras rotinas necessárias
String codigoTransacao[] = tituloPagina.split("~");
confirmaPagamento(1, agenda, codigoTransacao[1]);
progressDialogPagamentoCartao.dismiss();
progressDialogPagamentoCartao = null;
break;
}
}
}
});
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
}