<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Juan Cruz Gonzalez Soler on Medium]]></title>
        <description><![CDATA[Stories by Juan Cruz Gonzalez Soler on Medium]]></description>
        <link>https://medium.com/@juancruz.gsoler?source=rss-1828981a42a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Cfp9QqXyIi5JPFKjdsZnww.jpeg</url>
            <title>Stories by Juan Cruz Gonzalez Soler on Medium</title>
            <link>https://medium.com/@juancruz.gsoler?source=rss-1828981a42a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 03:34:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@juancruz.gsoler/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Biometrics API in a reactive way]]></title>
            <link>https://medium.com/major-league/biometrics-api-in-a-reactive-way-1a629bad2e2a?source=rss-1828981a42a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a629bad2e2a</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[biometrics]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[innovation]]></category>
            <dc:creator><![CDATA[Juan Cruz Gonzalez Soler]]></dc:creator>
            <pubDate>Fri, 01 Mar 2019 18:21:52 GMT</pubDate>
            <atom:updated>2019-03-01T18:21:52.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NBTMElROshaItJN2SeaYSA.png" /></figure><h3>Biometrics API in a Reactive Way</h3><h4>Biometric authentication methods ask for something you are (fingerprint, face, iris) to be sure that you are who you claim to be in a system. Let’s take a deeper look.</h4><p>Android provides us, developers, with an <strong>API</strong> to integrate biometric authentication in our apps in a simple and consistent way on all the devices that we use.</p><p>This new <strong>API</strong> is called <strong>BiometricPrompt. </strong>It replaces the <strong>FingerprintManager </strong>and gives us by default an authentication <strong>Dialog </strong>that will be the same in each and every device.</p><p><strong>BiometricPrompt</strong> is available for devices with <strong>Android 9 </strong>and higher, but there is a <strong>Compat Library</strong> to use it on older devices.</p><p>I will show you a way to implement it combined with <strong>RxKotlin.</strong></p><p>First you need to include the necessary dependencies in your <strong>build.gradle</strong> file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2965bc470d677f9e22dd50082be5cca3/href">https://medium.com/media/2965bc470d677f9e22dd50082be5cca3/href</a></iframe><p>Don’t forget to add the permission to your AndroidManifest:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ae541bd491bb82f7879bf82cf5e0213/href">https://medium.com/media/4ae541bd491bb82f7879bf82cf5e0213/href</a></iframe><p>Then you create 2 new classes to do the mapping between the API errors and our app errors:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c60f9ca9aa708d35874af1e6b3dfde1d/href">https://medium.com/media/c60f9ca9aa708d35874af1e6b3dfde1d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88bfb1a827b1061ca0b733f462dbf3a8/href">https://medium.com/media/88bfb1a827b1061ca0b733f462dbf3a8/href</a></iframe><p>Create an <strong>interface</strong> with the authentication method that we are going to call from our code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1199f89733506240f75a03090327122c/href">https://medium.com/media/1199f89733506240f75a03090327122c/href</a></iframe><p>And this is the implementation combined with <strong>RxKotlin</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31350b5c657581a4d54de4be49ccfb00/href">https://medium.com/media/31350b5c657581a4d54de4be49ccfb00/href</a></iframe><p>The parameters that we need to show the authentication <strong>Dialog</strong> are:</p><ul><li><strong>FragmentActivity</strong>: it will contain the <strong>DialogFragment </strong>created by the <strong>Biometrics API</strong></li><li><strong>Executor:</strong> to select in which <strong>Thread</strong> will run the authentication</li><li><strong>AuthenticationCallback: </strong>receives if the result was successful or if it has errors</li><li><strong>Title, Description, Subtitle, NegativeButtonText: </strong>define the strings that will be shown in the authentication<strong> Dialog</strong></li></ul><p>If there is any error we do a mapping to the 2 app errors that we created previously (you can add more if you need). By doing this, we just handle <strong>system errors</strong> (there are no fingerprints enrolled/ the device doesn’t have a biometric sensor) and <strong>user errors</strong> (the user cancelled the authentication manually / the user did too many failed attempts). You should define a different authentication flow for the system errors because they are unrecoverable.</p><p>All the API errors are listed in the class <strong>androidx.biometrics.BiometricConstants </strong>if you need more information about them.</p><p>And finally we call the authentication method from our <strong>MainActivity</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e26530d6666da2f77afd36a801baa34e/href">https://medium.com/media/e26530d6666da2f77afd36a801baa34e/href</a></iframe><p>This is how the authentication <strong>Dialog</strong> will look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/0*Pi4wrqFTAA2fHS_i" /></figure><ul><li><strong>Full code:</strong></li></ul><p><a href="https://gist.github.com/juancruzgs/b38700fd3c78d4552b0241a3ad4bdeb2">https://gist.github.com/juancruzgs/b38700fd3c78d4552b0241a3ad4bdeb2</a></p><ul><li><strong>References:</strong></li></ul><p><a href="https://source.android.com/security/biometric">https://source.android.com/security/biometric</a></p><p><a href="https://android-developers.googleblog.com/2018/06/better-biometrics-in-android-p.html">https://android-developers.googleblog.com/2018/06/better-biometrics-in-android-p.html</a></p><p><a href="https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt">https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt</a></p><h4>Do you know any suggestions? Leave a comment! We really appreciate it.</h4><p><a href="http://majorleague.co/"><strong>Major League</strong></a><strong> is a Staffing and Sourcing agency by </strong><a href="http://lateralview.co/"><strong>Lateral View</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a629bad2e2a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/major-league/biometrics-api-in-a-reactive-way-1a629bad2e2a">Biometrics API in a reactive way</a> was originally published in <a href="https://medium.com/major-league">Major League</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>