10 February 2016
Basic familiarity with building mobile apps on Adobe AIR, including familiarity with Adobe Native Extensions.
Required third-party products
All
Fingerprint authentication enables an end-user to use their fingerprint as passcode. With the release of Android 6.0, Google has introduced new APIs to authenticate users by using their fingerprint scans on supported devices.
Fingerprint Native Extension allows an ActionScript developer to access Android's Fingerprint APIs in the AIR app. This article explains how to use this Fingerprint native Extension in your AIR app using sample project files that are available in the attached FingerprintANE.zip file. The zip file contains the following:
The Fingerprint class in the ActionScript library provides the following public methods:
public function authenticateFingerPrint( ):voidpublic function isSupported( ):BooleanThe AIR application can create many instances of the Fingerprint class. However, the Fingerprint class creates only one ExtensionContext class instance, which is shared by all the Fingerprint instances.
To use Fingerprint ANE, follow these steps:


authenticateFingerPrint() method and also add event handler provided by the ANE.var fingprint:Fingerprint = new Fingerprint();
fingprint.addEventListener(FingerprintEvent.STATUS,AuthenticateStatus);
fingprint.authenticateFingerPrint();
isSupported() method to check whether the Fingerprint Authentication is supported by the Android device or not. The method returns true if a device is supported, otherwise false. if(fingprint.isSupported())
{
fingprint.addEventListener(FingerprintEvent.STATUS,AuthenticateStatus);
fingprint.authenticateFingerPrint();
}
import com.adobe.FingerprintLibrary.*;AuthenticateStatus method call. To do so, add the following function:protected function AuthenticateStatus(event:FingerprintEvent):void
{
var checkUser:String = "Authorization Status: "+event.status+" "+event.statusReason;
}
You may receive the following combination of values for event.status and event.statusReason based on the Fingerprint authentication of a user.
event.status will be Authenticated and event.statusReason will be Authorized User.event.status will be Failed and event.statusReason will be Unauthorized User.event.status will be Error and event.statusReason will be Error Occured:Fingerprint operation canceled.

Android Applications
To use Fingerprint APIs on Android 6.0, include the USE_FINGERPRINT permission in your application descriptor file:
<uses-permission android:name="android.permission.USE_FINGERPRINT "/>
The Android native library is implemented in Java, using the native extension Java API. The classes which implement FREFunction get FREContext object as the first parameter and FREObject array as the second parameter in their call() method. The native library includes the following classes:
FingerprintExtension implements FREExtension: This class contains the createContext() method. This method is called by the AIR runtime when ExtensionContext.createExtensionContext() is invoked on the ActionScript side; it returns a FingerprintExtensionContext class instance. The initialize() and dispose() methods are called by the AIR runtime on extension initialization and destruction respectively.
FingerprintExtensionContext extends FREContext: This class contains the getFunctions() method. This is an abstract method returning a Map Object functionMap that associates the extension function keys to the native FREFunction implementations.
FingerprintCheckFunction implements FREFunction: This class is mapped to showFingerprintFunction function key in the FingerprintExtensionContext class. It first checks whether the Fingerprint has been enrolled or not. If Fingerprint exists, it generates the keystore and launches the dialog for Fingerprint Authentication.
FingerprintSupportFunction implements FREFunction: This class is mapped to FingerprintSupportFunction function key in the FingerprintExtensionContext class. It checks whether the current Android Version is above Lollipop or not and then it checks whether the device hardware supports Fingerprint scanning or not. It returns true if supported, otherwise false.
For more information about developing native extensions for Adobe AIR, see:
For more information about using a native extension in an AIR application, see Using native extensions for Adobe AIR.