Skip to main content

Offline Biometric Instrumentation

info

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.

info

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: 

  1. Add fingerprint-mock.jar to your app's build.gradle

    implementation files('YOUR_MOCK_JAR_LOCATION\fingerprint-mock.jar')
  2. Replace the following:

    • android.hardware.fingerprint.FingerprintManager with com.mock.FingerprintManager
    • android.hardware.fingerprint.FingerprintFactory with com.mock.FingerprintFactory
    • If you use the FingerPrintManager service: getSystemService(FingerprintManager.class) withFingerprintFactory.getInstance(<context>)
    • android.security.keystore.KeyGenParameterSpec.Builder with com.mock.KeyGenParameterSpec.Builder
    • keyguardManager.isKeyguardSecure() with com.mock.KeyguardManager.isKeyguardSecure(keyguardManager)
    • If you use the android.hardware.biometrics library - biometricManager.canAuthenticate() with com.mock.biometrics.BiometricManager.canAuthenticate(biometricManager)
    • If you use the androidx.biometric library - BiometricManager.from(applicationContext).canAuthenticate() with biometricManagerx = BiometricManager.from(applicationContext); com.mock.biometrics.BiometricManager.canAuthenticate(biometricManagerx);
  3. 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
    }