Offline Biometric Instrumentation
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
Offline Biometric Instrumentation is the process of adding Continuous Testing's fingerprint mocking capabilities to the app in the app build process, as opposed to adding those libraries in the import process.
To obtain the source code JAR, contact technical support.
Instrument Biometric Libraries
To instrumenting the biometric libraries, make the following changes in the Android application source code:
-
Add
fingerprint-mock.jar
to your app'sbuild.gradle
.implementation files('YOUR_MOCK_JAR_LOCATION\fingerprint-mock.jar')
-
Replace the following:
android.hardware.fingerprint.FingerprintManager
withcom.mock.FingerprintManager
android.hardware.fingerprint.FingerprintFactory
withcom.mock.FingerprintFactory
- If you use the
FingerPrintManager
service:getSystemService(FingerprintManager.class)
withFingerprintFactory.getInstance(<context>)
android.security.keystore.KeyGenParameterSpec.Builder
withcom.mock.KeyGenParameterSpec.Builder
keyguardManager.isKeyguardSecure()
withcom.mock.KeyguardManager.isKeyguardSecure(keyguardManager)
- If you use the
android.hardware.biometrics
library -biometricManager.canAuthenticate()
withcom.mock.biometrics.BiometricManager.canAuthenticate(biometricManager)
- If you use the
androidx.biometric
library -BiometricManager.from(applicationContext).canAuthenticate()
withbiometricManagerx = BiometricManager.from(applicationContext); com.mock.biometrics.BiometricManager.canAuthenticate(biometricManagerx);
-
Register the fingerprint broadcast receiver in the application's Android Manifest.
<receiver android:name="com.mock.FingerPrintReceiver">
<intent-filter>
<action android:name= "<YOUR_APPLICATION_ID>.fpip.ir"/>
</intent-filter>
</receiver>
You may encounter some unexpected errors in the application codebase, such as -
-
java.lang.BootstrapMethodError: Exception from call site #2 bootstrap method - This may be because the application does not have JAVA_1_8 source compatibility.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}