1

Requirement : How to use native fingerprint scanner UI for onscreen sensor android devices (like Samsung s10 plus).

Working flow of fingerprint authentication is understandable. But is there any method or libraries available for obtaining native fingerprint scanner UI ?

SARATH V
  • 500
  • 1
  • 7
  • 33
  • @RahulKhurana i'm aware about the code and working flow. Question is about native UI for different devices.. Some with separate scanner and some with onscreen scanner. – SARATH V Aug 13 '19 at 06:51
  • 1
    As there are multiple device manufacturers which customize UI on the OS level. There is no official API by google to achieve it. – Rahul Khurana Aug 13 '19 at 07:00

1 Answers1

1

Solution is to create a custom UI and replace it so that it'll be same UI for all devices

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);
}

BiometricCallback

public interface BiometricCallback {

void onAuthenticationFailed();

void onAuthenticationCancelled();

void onAuthenticationSuccessful();
}
Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77