Reputation: 1416
Below is the message I get from Google Play.
After I read the message, I take a look on Google Help Center article. For what I thought, this should be related to the class of WebViewClient
and some of its methods like onReceivedSslError
, SslErrorHandler.proceed()
or SslErrorHandler.cancel()
. Then in my project, I try to search some keywords like WebViewClient
, SslErrorHandler
or onReceivedSslError
. I also get the result of Nothing to show.
Any suggestions to solve this issue?
Upvotes: 2
Views: 1971
Reputation: 391
show pop up or dialog with continue and cancel.
continue handler.proceed()
cancel handler.cancel()
we need ask user, when this error comes, to continue or to stop.
like this
val builder = AlertDialog.Builder(cntx)
var message = "SSL Certificate error."
when (error?.primaryError) {
SslError.SSL_UNTRUSTED -> message = "The certificate authority is not trusted."
SslError.SSL_EXPIRED -> message = "The certificate has expired."
SslError.SSL_IDMISMATCH -> message = "The certificate Hostname mismatch."
SslError.SSL_NOTYETVALID -> message = "The certificate is not yet valid."
}
message += " Do you want to continue anyway?"
builder.setTitle("SSL Certificate Error")
builder.setMessage(message)
builder.setPositiveButton(
"continue"
) { dialog, which -> handler?.proceed() }
builder.setNegativeButton(
"cancel"
) { dialog, which -> handler?.cancel() }
val dialog = builder.create()
dialog.show()
Upvotes: 2