-1
How can I save a user and password in the android webview?
On the page (web), it is requested Cpf and password, for login. After this entry, the cookie is saved vis_cod
, which is a return parameter created (on the web) from the password cpfe that were entered. How to save this parameter, in webview and access the app without the need to enter Cpf and password, always?
public class fanpageActivity extends AppCompatActivity {
private WebView mywebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fanpage);
mywebView = (WebView) findViewById(R.id.webview2);
mywebView.getSettings().setJavaScriptEnabled(true);
mywebView.getSettings().setDomStorageEnabled(true);
mywebView.loadUrl("http://mydomain.com/domain");
mywebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
ProgressBar pb = (ProgressBar) findViewById(R.id.progress);
pb.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished(WebView view, String url) {
ProgressBar pb = (ProgressBar) findViewById(R.id.progress);
pb.setVisibility(View.INVISIBLE);
mywebView.setVisibility(View.VISIBLE);
}
@Override
public boolean shouldOverrideUrlLoading(final WebView myWebview, String url) {
//Abrir telefone
if (url.contains("tel:")) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
startActivity(intent);
myWebview.reload();
return false;
}
//Abrir Whatsapp
else if (url.contains("api.whatsapp")) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
myWebview.reload();
return false;
} else {
myWebview.loadUrl(url);
return true;
}
/* myWebview.loadUrl(url);
return false;*/
}
});
}