RUVIDEO
Поделитесь видео 🙏

How to implement Biometric authentication in your Android App? - complete source code

This video shows the steps to implement the Biometric authentication in your Android App.

It uses the androidx.biometric implementation in the App's gradle file for the same. For Biometric authentication, it uses AuthenticationCallback from BiomentricPrompt class from the implemented Biometric libraries in the App's code.

To interpret the results, it simply uses a text view to display the results of the biometric scan whether it succeeded, failed or error.

As the biometric scanner is not available on the emulator, it uses the real device to test the App. The testing of the App on a real phone (device) is shown towards the end of the video.


I hope this video is useful to you. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: [email protected]


The complete source code and details of this video is shared in the below link:
https://programmerworld.co/android/how-to-implement-biometric-authentication-in-your-android-app-complete-source-code/

The main Java code is copied below also for reference:

package com.programmerworld.biometricauthenticationapp;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.biometric.BiometricManager;
import androidx.biometric.BiometricPrompt;
import androidx.core.content.ContextCompat;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import java.util.concurrent.Executor;

public class MainActivity extends AppCompatActivity {

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

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

textView = findViewById(R.id.textView);
executor = ContextCompat.getMainExecutor(this);

biometricPrompt = new BiometricPrompt(this, executor, new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
super.onAuthenticationError(errorCode, errString);
textView.setText("Error");
}

@Override
public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);

textView.setText("Success");
}

@Override
public void onAuthenticationFailed() {
super.onAuthenticationFailed();

textView.setText("Failure");
}
});

promptInfo = new BiometricPrompt.PromptInfo.Builder()
.setTitle("Programmer World Authentication")
.setNegativeButtonText("Cancel/ Use Password")
.setConfirmationRequired(false)
.build();
}

public void buttonAuthenticate(View view){
BiometricManager biometricManager = BiometricManager.from(this);
if (biometricManager.canAuthenticate() != BiometricManager.BIOMETRIC_SUCCESS){

textView.setText("Biometric Not Supported");
return;
}
biometricPrompt.authenticate(promptInfo);
}
}

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «How to implement Biometric authentication in your Android App? - complete source code», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.