@Marcos Alves
A possible solution to your problem could be:
1. Download this library
https://www.b4x.com/android/forum/threads/webviewextras.12453/
2. Use this code to check for an SSL certificate error: (Thanks to
@warwound and
@Erel for the "Original" code)
Modify as you require - guideline only
Sub Globals
Private WebView1 As WebView
Dim WebViewExtras1 As WebViewExtras
Dim WebViewSetting1 As WebViewSettings
End Sub
Sub Activity_Create(FirstTime As Boolean)
WebViewExtras1.Initialize(WebView1)
Dim WebViewClient1 As DefaultWebViewClient
WebViewClient1.Initialize("WebViewClient1")
WebViewExtras1.SetWebViewClient(WebViewClient1)
WebViewExtras1.LoadUrl("https://sitesample.com:9001/test/test.html")
End Sub
Sub WebViewClient1_ReceivedSslError(SslErrorHandler1 As SslErrorHandler, SslError1 As SslError)
Log("WebViewClient1_ReceivedSslError: "&SslError1.GetUrl)
' you might want to take action depending on the type of the SSL error:
Select SslError1.GetPrimaryError
Case SslError1.SSL_DATE_INVALID
Log("SSL_DATE_INVALID")
Case SslError1.SSL_EXPIRED
Log("SSL_EXPIRED")
Case SslError1.SSL_IDMISMATCH
Log("SSL_IDMISMATCH")
Case SslError1.SSL_INVALID
Log("SSL_INVALID")
Case SslError1.SSL_MAX_ERROR
Log("SSL_MAX_ERROR")
Case SslError1.SSL_NOTYETVALID
Log("SSL_NOTYETVALID")
Case SslError1.SSL_UNTRUSTED
Log("SSL_UNTRUSTED")
End Select
LogColor("SSL Error: "&SslError1.GetUrl,Colors.Red)
' you might want to compare the url that raised the error with a known trusted URL and Proceed or Cancel with the page loading:
If SslError1.GetUrl = "https://sitesample.com:9001/test/test.html" Then
Log("Proceed with the SSL Error")
btnCancel2.SetVisibleAnimated(600,False)
btnApprove.SetVisibleAnimated(900,False)
SslErrorHandler1.Proceed
Else
SslErrorHandler1.Cancel
End If
End Sub
Now, once you have established what the problem could be - you can take the next steps.