0

i have a problem with sign in with fingerprint, tried this code from google android Docs

private Executor executor;
private BiometricPrompt biometricPrompt;
private BiometricPrompt.PromptInfo promptInfo;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    executor = ContextCompat.getMainExecutor(this);
    biometricPrompt = new BiometricPrompt(MainActivity.this,
            executor, new BiometricPrompt.AuthenticationCallback() {
        @Override
        public void onAuthenticationError(int errorCode,
                @NonNull CharSequence errString) {
            super.onAuthenticationError(errorCode, errString);
            Toast.makeText(getApplicationContext(),
                "Authentication error: " + errString, Toast.LENGTH_SHORT)
                .show();
        }

        @Override
        public void onAuthenticationSucceeded(
                @NonNull BiometricPrompt.AuthenticationResult result) {
            super.onAuthenticationSucceeded(result);
            Toast.makeText(getApplicationContext(),
                "Authentication succeeded!", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onAuthenticationFailed() {
            super.onAuthenticationFailed();
            Toast.makeText(getApplicationContext(), "Authentication failed",
                Toast.LENGTH_SHORT)
                .show();
        }
    });

    promptInfo = new BiometricPrompt.PromptInfo.Builder()
            .setTitle("Biometric login for my app")
            .setSubtitle("Log in using your biometric credential")
            .setNegativeButtonText("Use account password")
            .build();

    // Prompt appears when user clicks "Log in".
    // Consider integrating with the keystore to unlock cryptographic operations,
    // if needed by your app.
    Button biometricLoginButton = findViewById(R.id.biometric_login);
    biometricLoginButton.setOnClickListener(view -> {
            biometricPrompt.authenticate(promptInfo);
    });
}

the problem with BiometricPrompt is that this service uses the fingerprint stored in the system, what i want is to create store new finger for example in my app and send it to my server , so the user can open the app from any android phone is that possible? and how?

  • 1
    Do you even realize that doing this will be a huge violation to User's Trust? Thats a very crucial data, no one will ever want their bio-metrics to be stored in an outside server, obviously without their permission. – Abhishek Dutt Nov 04 '21 at 10:54
  • Secondly, such data is locked in the device hardware, so I don't think so you will be able to send to your server – Abhishek Dutt Nov 04 '21 at 10:56
  • i don't think so because our pictures, videos, sensitive info now are stored in servers, ever our money etc... we just need to let the user know about the action – youness makhfi Nov 04 '21 at 15:16

0 Answers0