android - android recaptcha 安全网检测对话框取消
问题描述
我正在尝试检测重新验证取消对话框,但 addOnCancelListener 不起作用,代码如下:
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()
}
我还尝试防止用户在加载验证码任务对话框时触摸屏幕,但始终触摸对话框外部会关闭对话框,所以请任何想法检测取消或防止用户在加载验证码时触摸外部
解决方案
推荐阅读
- php - 如何在 phpdesktop-chrome 中嵌入 mysql
- latex - 同情符号$Delta x$
- javascript - 如何在不使用任何 npm 包的情况下在 react native 中制作自定义轮播或图像幻灯片
- angular - 如何从输入文件中删除重复文件(Angular)
- spring-boot - 为什么 LoginModule 中的 @Autowired 返回 null?
- sql - 如何检查行数趋势
- python-3.x - 如何从python中类的属性名称中获取值?
- python - 如何修复 Tkinter 中的 IndexError?
- reactjs - React MUI输入边框颜色变量
- google-sheets - 我用什么函数在谷歌表格中制作一列每次产生一个总和结果,而不是最后一个总数