我已react-native-fingerprint-scanner
在我的应用程序中实现的正常工作Touch Id
。
现在,我想为两个平台的Touch ID,Face ID和密码进行身份验证
是否可以检查您的设备是否分别要求支持lock pattern
?
我也尝试过使用react-native-touch-id
但它对我不起作用Face Id
有什么方法可以在两个平台(iOS / android)上实现这一目标吗?
参考:链接
我正在开发一个应用程序,我需要通过为用户设置密码/密码/pin 来设置安全功能,以便每当他们从后台打开应用程序时,应用程序都会要求输入密码/密码/pin。我读了一些这样的文章/解决方案,但它们对我没有帮助。我们在普通银行应用程序中发现了相同的功能,每当您打开应用程序时,他们都会要求输入密码/指纹。
我已经设置了将密码/密码保存在共享首选项中的逻辑,但我不确定何时询问。我知道我们不能用密码/pin 活动替换启动屏幕,因为有时从应用程序的 homeScreen/MainActivity 中,用户按下主页按钮,当他们再次从最近的应用程序打开应用程序时,应用程序应该要求密码/pin 来恢复应用程序使用。
任何帮助,将不胜感激。
实际上,我构建了一个包含本地身份验证的应用程序。
到目前为止我的代码:
func authenticateUser() {
let authenticationContext = LAContext()
var error: NSError?
let reasonString = "Touch the Touch ID sensor to unlock."
// Check if the device can evaluate the policy.
if authenticationContext.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &error) {
authenticationContext.evaluatePolicy( .deviceOwnerAuthenticationWithBiometrics, localizedReason: reasonString, reply: { (success, evalPolicyError) in
if success {
print("success")
} else {
if let evaluateError = error as NSError? {
// enter password using system UI
}
}
})
} else {
print("toch id not available")
// enter password using …
Run Code Online (Sandbox Code Playgroud) 此活动最初可以正常工作,但后来突然停止工作,并向我显示了此错误。我不知道如何修复它,我不记得从我的 app.gradle 文件中删除了任何东西,但有谁知道如何解决它?任何帮助将不胜感激
下面是我的密码视图主要活动(下面显示的 XML 有错误) ''' PasscodeView PasswordView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_password_view);
PasswordView = findViewById(R.id.PasswordView);
PasswordView.setPasscodeLength(4)
.setLocalPasscode("1234")
.setListener(new PasscodeView.PasscodeViewListener() {
@Override
public void onFail() {
Toast.makeText(PasswordView.this, "Passcode do not match",Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess(String number) {
Intent intent = new Intent(PasswordView.this,Main2Activity.class);
startActivity(intent);
}
});
}}
Run Code Online (Sandbox Code Playgroud)
'''