When I show a url that has a security certificate (https://), the view stays blank, but the ones that do not have a security certificate load without problem (http://).
Below is the code that shows the view of the page with security certificate, I use a webView container.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_noticias, container, false);
WebView view=(WebView) v.findViewById(R.id.wv_noticias);
view.getSettings().setJavaScriptEnabled(true);
view.setWebViewClient(new WebViewClient());// Agregamos un WebViewCliente, esto permite que se sigan ejecutando los links dentro de este WebView
//view.loadUrl(url);
/****************************************/
if (isOnline(getActivity())) {
String url="https://www.uniagustiniana.edu.co/Noticias/";
view.loadUrl(url);
//Toast.makeText(getActivity(),"SI hay conexión!",Toast.LENGTH_SHORT).show();
} else {
view.loadUrl("file:///android_asset/html/pagina_error.html");
Toast.makeText(getActivity(),"NO hay
conexión!",Toast.LENGTH_SHORT).show();
}
/****************************************/
return v;
}
Good morning Ivan, you just have to add a WebViewClient you can add it as follows:
I hope it will be useful to you. Greetings.
Using the WebClient you must override the onReceivedSslError() method .
Example:
The common thing is to cancel the load but in this case it simply indicates that I continue by
handler.proceed()
Update:
In the case of uploading an application to the Google Play Store, care must be taken since it will surely not be accepted, the reason is that if an SSL error occurs, the page should not be loaded, on the contrary, it should be canceled, this for security reasons.
https://support.google.com/faqs/answer/7071387?hl=en
For this you must implement a dialog which tells the user if he wants to proceed or cancel the upload, with this your application can be uploaded to the Google Play Store without problem.