I'm trying to detect recaptcha cancelation dialog but addOnCancelListener is not working the code is the bellow:
SafetyNet.getClient(this).verifyWithRecaptcha(getString(R.string.API_SITE_KEY))
.addOnSuccessListener(this) { response ->
progressBar.visibility=View.GONE
if (!response.tokenResult.isEmpty()) {
sendMessage()
}else{
Toast.makeText(applicationContext,"1111",Toast.LENGTH_LONG).show()
}
}
.addOnFailureListener(this) { e ->
Toast.makeText(applicationContext,"2222",Toast.LENGTH_LONG).show()
if (e is ApiException) {
Log.wtf("captcha_contact",("Error message: " +
CommonStatusCodes.getStatusCodeString(e.statusCode)))
} else {
Log.wtf("captcha_contact", "Unknown type of error: " + e.message)
}
}
.addOnCanceledListener (this){
Toast.makeText(applicationContext,"33333",Toast.LENGTH_LONG).show()
}
I tried also to prevent user from touching screen while loading captcha task dialog but always touching outside the dialog will dismiss the dialog so please any idea to detect the cancelation or preventing user from touching outside while loading captcha