API Development

Android Fingerprint Authentication Using Titanium

This guest post was authored by Adam Armstrong. Adam has been using Titanium since 2010 and is an Appcelerator Titan. He is the Manager of Mobile Technology at AmWINS Group and does freelance work via https://implicitli.com. You can follow him on Twitter at @adamtarmstrong.

A common pain-point for Titanium developers is implementing fingerprint authentication for Android. Hyperloop (especially now that it’s free) solved the technical challenge, but the UI/Presentation layer still remained left to the developer.

I recently took Google’s Material Guideline for Fingerprint Behavior and created my own Titanium Widget to solve that issue and make it portable for use in several of my other apps.

Android Fingerprint Authentication Using Titanium


  1. Appcelerator/Titanium
  2. Hyperloop
  3. Some method of fingerprint authentication, such as:

    TouchID — https://github.com/appcelerator-modules/ti.touchid


    Ti.Reprint Hyperloop .aar and common.js — https://github.com/loop-modules/Ti.Reprint

  4. ti.androidfingerprintalertdialog widget — https://github.com/adamtarmstrong/ti.androidfingerprintalertdialog


1–2. I won’t go into these; there are numerous articles, docs, and wiki’s to cover those.

3. Setup Ti.Reprint Hyperloop Module in your app (again, you could use the ti.touchid module here as well — I just chose to test the Hyperloop implementation)

a. Copy the github file /Ti.Reprint/app/platform/android/core-2.8.3.aar to your ‘project’/app/platform/android/ folder

Reprint is a unified fingerprint authentication library for Android that supports multiple fingerprint APIs — including Imprint & Samsung Pass. https://github.com/ajalt/reprint

b. Copy the github file /Ti.Reprint/app/lib/Reprint.js to your ‘project’/app/lib/ folder

This library provides various methods to initialize, authenticate, check if device supports fingerprint, verifies fingerprints are registered, and more.

c. Update your tiapp.xml file to allow your app to use android.permission.USE_FINGERPRINT

<uses-permission android:name="android.permission.USE_FINGERPRINT"/>

4. Setup ti.androidfingerprintalertdialog widget

a. Download/extract widget and copy the ‘ti.androidfingerprintalertdialog’ folder to your ‘project/app/widgets/ folder

b. Update your ‘project’/app/config.json file to add the widget

"dependencies": {
     "ti.androidfingerprintalertdialog": "1.0"


Add Widget to your view (typically your login page)


<Widget id="androidFingerprint" src="ti.androidfingerprintalertdialog" />


    • Require and initialize the Reprint common.js module.

var Reprint = require('reprint');
  • Setup 4 functions to handle success, failure, click:UsePassword & click:Cancel
    function successCallback(moduleTag) {
         //Continue login process
    function failureCallback(failureReason, fatal, errorMessage, moduleTag, errorCode) {
    function fingerprintUsePassword(){
    function fingerprintCancel(){
  • Prompt for fingerprint

    Verify that device BOTH has the hardware and a fingerprint is registered

    if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered())
  • Request Authentication and show AlertDialog Widget and pass in the 4 methods we just created
    Reprint.authenticate(successCallback, failureCallback);
    $.androidFingerprint.show(fingerprintUsePassword, fingerprintCancel);

That’s it!

The Widget Repo and full implementation example can be found here. Contributions welcomed!