<?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 Sergej Komlach on Medium]]></title>
        <description><![CDATA[Stories by Sergej Komlach on Medium]]></description>
        <link>https://medium.com/@sergejkomlach?source=rss-da483a21795b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ljisMzWUiSPLSm-g.</url>
            <title>Stories by Sergej Komlach on Medium</title>
            <link>https://medium.com/@sergejkomlach?source=rss-da483a21795b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 03:29:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sergejkomlach/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[Pain(less) Biometric on Android]]></title>
            <link>https://medium.com/@sergejkomlach/pain-less-biometric-on-android-73b529f05619?source=rss-da483a21795b------2</link>
            <guid isPermaLink="false">https://medium.com/p/73b529f05619</guid>
            <category><![CDATA[biometrics]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-12]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Sergej Komlach]]></dc:creator>
            <pubDate>Thu, 11 Nov 2021 20:23:53 GMT</pubDate>
            <atom:updated>2021-11-12T09:55:26.278Z</atom:updated>
            <content:encoded><![CDATA[<p>When <strong>BiometricPrompt </strong>was introduced in 2019, many of us decided that this was a victory: a unified UI, the system deals with different types of biometrics, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5iyK5xlrd5yjhAPf" /></figure><p>But in reality, it was a nightmare.</p><p>Even when it was just the <strong>Fingerprint API</strong>, there weren’t so many problems.</p><p>The guys from Google suggested a fantastic initiative and made a pretty good<strong><em> androidx.biometric</em></strong> library. However, it only added a layer of backward compatibility, and it did not solve the huge list of problems associated with biometrics.</p><p>Just a few examples from real life:</p><ul><li>On Android 9, there is no option to check biometric hardware, as well as biometric data registered in the system</li><li>It is not clear how to define an in-display fingerprint scanner</li><li>There are many devices with face unlocking, but BiometricPrompt does not have access to this functionality</li><li>There is no way to choose or even to determine the type of biometric on the device</li><li>OnePlus 6T: Fingerprint scanner does not recognize finger in the app</li><li>OnePlus 6T: no BiometricPrompt UI for in-display scanner</li><li>Face unlock stops working on Pixel 4 running Android 12 if the camera is “muted” from Quick Settings</li></ul><p>I have been working on biometric authentication since the Samsung Pass release in 2014 and have some specific requirements for this procedure. Something like described in the code listed below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5dd4f36ced396dc7d09fb343bab9ec7d/href">https://medium.com/media/5dd4f36ced396dc7d09fb343bab9ec7d/href</a></iframe><p>Several key points:</p><ul><li>Ability to check biometric state BEFORE BiometricAuth started</li><li>Compatibility with the most devices</li><li>Consistent UI/UX across all OS versions and devices</li><li>Face/IrisId unlock support, additionally to Fingerprint</li><li>Blocking UI behind Biometric dialog (especially useful for dual-screen devices like Microsoft Surface Duo or LG Wing)</li><li>Informing the user about biometrics used for authentification</li><li>Plus, the issues mentioned above should be fixed</li></ul><p>To meet these requirements, while also addressing known issues and limitations, I developed the complex of solutions, which were evolved into a separate library.</p><p>This is how the <strong>Advanced BiometricPromptCompat</strong> was born.</p><p>So, what <strong>BiometricPromptCompat</strong> library can do:</p><p><strong>1)</strong> Fingerprint/BiometricPrompt auth of course</p><p><strong>2) </strong>FaceAuth on Samsung, Xiaomi, Huawei, etc., vary from vendor and OS version</p><p><strong>3)</strong> Iris Auth — Samsung devices</p><p><strong>4)</strong> Compatible with Android OS versions starting from Android 4.1 and up to Android 12L and newer</p><p><strong>5) </strong>BiometricManagerCompat allows checking the availability of biometric hardware, enrollments, sensor lockout, etc.</p><p><strong>6)</strong> Allows to pick specific biometrics — for example, only Face or only Fingerprint</p><p><strong>7)</strong> Determination of an in-display scanner</p><p><strong>8)</strong> Fixes for devices with an in-display scanner without UI</p><p><strong>9)</strong> Fixes for the “muted” camera on Android 12, that blocks FaceUnlock</p><p>For more features and compatible devices — see the “<a href="https://github.com/Salat-Cx65/AdvancedBiometricPromptCompat#key-features">Key features</a>” section.</p><p>To test the app please follow this <a href="https://github.com/Salat-Cx65/AdvancedBiometricPromptCompat/blob/main/app/app-debug.apk">link</a>.</p><p><strong>App test example on Huawei P40<em>:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/0*lnyq6YWVth7hieaL" /></figure><p>In general, the<em> </em><strong><em>BiometricPromptCompat</em></strong><em> </em>is made as similar as possible to the original <strong><em>BiometricPrompt</em></strong> and requires minimal changes in existing code.</p><p>Let’s look closer.</p><p><strong>BiometricAuthRequest:</strong></p><p>Allows configuring biometrics recognition behavior. The default is</p><pre>BiometricAuthRequest (BiometricApi.AUTO, BiometricType.BIOMETRIC_ANY, BiometricConfirmation.ANY)</pre><ul><li><strong>BiometricApi </strong>is a way to work with biometrics sensors. It can be<em> AUTO, BIOMETRIC_PROMPT, or LEGACY</em></li><li><strong>BiometricType </strong>specifies which biometrics to use. It can be<em> BIOMETRIC_FINGERPRINT, BIOMETRIC_FACE, BIOMETRIC_IRIS</em></li><li><strong>BiometricConfirmation </strong>indicates the identity confirmation rule. If we specify<em> ANY</em>, any (if there are several) biometrics ends the authentication procedure. <em>ALL </em>will wait for all biometrics to verify their identity</li></ul><p><strong>BiometricManagerCompat</strong></p><pre>fun hasEnrolled (BiometricAuthRequest): Boolean</pre><p>determines if biometric is registered on the device</p><pre>fun isHardwareDetected (BiometricAuthRequest): Boolean</pre><p>returns TRUE if the specified biometrics is available on the device</p><pre>fun isLockOut (BiometricAuthRequest): Boolean</pre><p>and</p><pre>fun isBiometricSensorPermanentlyLocked (BiometricAuthRequest): Boolean</pre><p>allows checking if biometrics are locked (short term or long term, respectively).</p><p><strong>BiometricPromptCompat</strong></p><p>Firstly, this is the main entry point to the library, so it is better to start initialization in the <em>Application.onCreate(), </em>just call</p><pre>BiometricPromptCompat.init ()</pre><p>After initialization is finished, we can start working with <strong>BiometricPromptCompat </strong>API</p><pre>fun getAvailableAuthRequests: List &lt;BiometricAuthRequest&gt;</pre><p>it returns the list of available biometrics on this device.</p><p>To work with biometric authentication flow, we need a <strong>BiometricPromptCompate</strong> instance. You need to use the builder for this:</p><pre>val prompt = BiometricPromptCompat.Builder(BiometricAuthRequest, fragmentActivity).apply <strong>{<br>            </strong>this.setTitle(title)<br>            this.setNegativeButton(&quot;Cancel&quot;, null)<br>        <strong>}</strong>.build()</pre><p>Now we are ready to start biometric authentication:</p><pre>fun authenticate(BiometricPromptCompat.AuthenticationCallback)</pre><p>And to cancel the biometric authentication dialog:</p><pre>fun cancelAuthenticate()</pre><p>For more detailed information, see the library <a href="https://github.com/Salat-Cx65/AdvancedBiometricPromptCompat#advanced-biometricpromptcompat">documentation</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73b529f05619" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>