![](/img/trans.png)
[英]How to use a phones fingerprint sensor as a bio metric(fingerprint) scanner
[英]How to use native fingerprint scanner UI in android devices?
要求:如何将原生指纹扫描仪 UI 用于屏幕传感器 android 设备(如三星 s10 plus)。
指纹认证的工作流程是可以理解的。 但是是否有任何方法或库可用于获取本机指纹扫描仪 UI?
解决方案是创建一个自定义 UI 并替换它,以便它对于所有设备都是相同的 UI
public class MyFingerPrintDialog extends BottomSheetDialog implements
View.OnClickListener {
private Context context;
private Button btnCancel;
private TextView itemTitle;
private BiometricCallback biometricCallback;
public MyFingerPrintDialog(@NonNull Context context) {
super(context, R.style.BottomSheetDialogTheme);
this.context = context.getApplicationContext();
setDialogView();
}
public MyFingerPrintDialog(@NonNull Context context, BiometricCallback biometricCallback) {
super(context, R.style.BottomSheetDialogTheme);
this.context = context.getApplicationContext();
this.biometricCallback = biometricCallback;
setDialogView();
}
public MyFingerPrintDialog(@NonNull Context context, int theme) {
super(context, theme);
}
protected MyFingerPrintDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
}
private void setDialogView() {
View bottomSheetView = getLayoutInflater().inflate(R.layout.view_bottom_sheet, null);
setContentView(bottomSheetView);
btnCancel = findViewById(R.id.btn_cancel);
btnCancel.setOnClickListener(this);
itemTitle = findViewById(R.id.item_title);
}
生物识别回调
public interface BiometricCallback {
void onAuthenticationFailed();
void onAuthenticationCancelled();
void onAuthenticationSuccessful();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.