Fingerprint Scanner Mantra (MFS 100) Biometric In Android Application Example

Mantra (MFS 100) Biometric Android Example.

Creating a New Project

First, we will create a new Android Studio Project.

1) Adding Jar File In Android Project.

  1. Now download the https://download.mantratecapp.com/Forms/UserDownload . Android SDK File And Get  mantra.mfs100.jar..
  2. So first on the project explorer select Project.
  3. Then inside app/lib paste the mantra.mfs100.jar that we downloaded.
  4. Then add dependency in your build.gradle.
implementation files('libs/mantra.mfs100.jar')

 

  • Adding jniLibs Folder
    · jniLibs.jar
    · Download jinLibs.jar file And then Extract.
    · Put jniLibs folder src/main/

 

  •  build.gradle In Your Project
  • apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 30
        defaultConfig {
            applicationId "com.mantra.mfs100testv9032"
            minSdkVersion 15
            targetSdkVersion 30
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
    
        dexOptions {
            preDexLibraries false
            javaMaxHeapSize "4g"
        }
        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        repositories {
            flatDir {
                dirs 'libs'
            }
        }
    
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'androidx.appcompat:appcompat:1.0.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    
    }
    

     

  • AndroidManifest.xml
  • <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.ThecodeHubsDemo.FingerprintScanner">
    
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.USB_PERMISSION" />
    
        <application
            android:name="androidx.multidex.MultiDexApplication"
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
            <activity
                android:name="com.ThecodeHubsDemo.FingerprintScanner.MFS100Test"
                android:configChanges="orientation|screenSize|keyboardHidden">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>

     

  • MFS100CodeHubs.java

 

package com.ThecodeHubsDemo.FingerprintScanner;

import android.app.Activity;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.mantra.mfs100.FingerData;
import com.mantra.mfs100.MFS100;
import com.mantra.mfs100.MFS100Event;


import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

public class MFS100CodeHubs extends Activity implements MFS100Event {
    private static long Threshold = 1500;
    private static long mLastClkTime = 0;
    byte[] Enroll_Template;
    byte[] Verify_Template;
    Button btnClearLog;
    Button btnExtractAnsi;
    Button btnExtractISOImage;
    Button btnExtractWSQImage;
    Button btnInit;
    Button btnMatchISOTemplate;
    Button btnStopCapture;
    Button btnSyncCapture;
    Button btnUninit;
    CheckBox cbFastDetection;
    ImageView imgFinger;
    private boolean isCaptureRunning = false;
    private FingerData lastCapFingerData = null;
    TextView lblMessage;
    private long mLastAttTime = 0;
    long mLastDttTime = 0;
    MFS100 mfs100 = null;
    ScannerAction scannerAction = ScannerAction.Capture;
    int timeout = 10000;
    EditText txtEventLog;

    /* access modifiers changed from: private */
    public enum ScannerAction {
        Capture,
        Verify
    }

    /* access modifiers changed from: protected */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mfs100_sample);
        FindFormControls();
        try {
            getWindow().setSoftInputMode(3);
        } catch (Exception e) {
            Log.e("Error", e.toString());
        }
        try {
            this.mfs100 = new MFS100(this);
            this.mfs100.SetApplicationContext(this);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    /* access modifiers changed from: protected */
    public void onStart() {
        try {
            if (this.mfs100 == null) {
                this.mfs100 = new MFS100(this);
                this.mfs100.SetApplicationContext(this);
            } else {
                InitScanner();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        super.onStart();
    }

    /* access modifiers changed from: protected */
    public void onStop() {
        try {
            if (this.isCaptureRunning) {
                this.mfs100.StopAutoCapture();
            }
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        super.onStop();
    }

    /* access modifiers changed from: protected */
    public void onResume() {
        super.onResume();
    }

    /* access modifiers changed from: protected */
    public void onDestroy() {
        try {
            if (this.mfs100 != null) {
                this.mfs100.Dispose();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        super.onDestroy();
    }

    public void FindFormControls() {
        try {
            this.btnInit = (Button) findViewById(R.id.btnInit);
            this.btnUninit = (Button) findViewById(R.id.btnUninit);
            this.btnMatchISOTemplate = (Button) findViewById(R.id.btnMatchISOTemplate);
            this.btnExtractISOImage = (Button) findViewById(R.id.btnExtractISOImage);
            this.btnExtractAnsi = (Button) findViewById(R.id.btnExtractAnsi);
            this.btnExtractWSQImage = (Button) findViewById(R.id.btnExtractWSQImage);
            this.btnClearLog = (Button) findViewById(R.id.btnClearLog);
            this.lblMessage = (TextView) findViewById(R.id.lblMessage);
            this.txtEventLog = (EditText) findViewById(R.id.txtEventLog);
            this.imgFinger = (ImageView) findViewById(R.id.imgFinger);
            this.btnSyncCapture = (Button) findViewById(R.id.btnSyncCapture);
            this.btnStopCapture = (Button) findViewById(R.id.btnStopCapture);
            this.cbFastDetection = (CheckBox) findViewById(R.id.cbFastDetection);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void onControlClicked(View v) {
        if (SystemClock.elapsedRealtime() - mLastClkTime >= Threshold) {
            mLastClkTime = SystemClock.elapsedRealtime();
            try {
                switch (v.getId()) {
                    case R.id.btnClearLog:
                        ClearLog();
                        return;
                    case R.id.btnExtractAnsi:
                        ExtractANSITemplate();
                        return;
                    case R.id.btnExtractISOImage:
                        ExtractISOImage();
                        return;
                    case R.id.btnExtractWSQImage:
                        ExtractWSQImage();
                        return;
                    case R.id.btnInit:
                        InitScanner();
                        return;
                    case R.id.btnMatchISOTemplate:
                        this.scannerAction = ScannerAction.Verify;
                        if (!this.isCaptureRunning) {
                            StartSyncCapture();
                            return;
                        }
                        return;
                    case R.id.btnStopCapture:
                        StopCapture();
                        return;
                    case R.id.btnSyncCapture:
                        this.scannerAction = ScannerAction.Capture;
                        if (!this.isCaptureRunning) {
                            StartSyncCapture();
                            return;
                        }
                        return;
                    case R.id.btnUninit:
                        UnInitScanner();
                        return;
                    default:
                        return;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setContentView(R.layout.activity_mfs100_sample);
        FindFormControls();
        try {
            if (this.mfs100 == null) {
                this.mfs100 = new MFS100(this);
                this.mfs100.SetApplicationContext(this);
            }
            if (this.isCaptureRunning && this.mfs100 != null) {
                this.mfs100.StopAutoCapture();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void InitScanner() {
        try {
            int ret = this.mfs100.Init();
            if (ret != 0) {
                SetTextOnUIThread(this.mfs100.GetErrorMsg(ret));
                return;
            }
            SetTextOnUIThread("Init success");
            SetLogOnUIThread("Serial: " + this.mfs100.GetDeviceInfo().SerialNo() + " Make: " + this.mfs100.GetDeviceInfo().Make() + " Model: " + this.mfs100.GetDeviceInfo().Model() + "\nCertificate: " + this.mfs100.GetCertification());
        } catch (Exception e) {
            Toast.makeText(getApplicationContext(), "Init failed, unhandled exception", 1).show();
            SetTextOnUIThread("Init failed, unhandled exception");
        }
    }

    private void StartSyncCapture() {
        new Thread(new Runnable() {
            /* class MFS100Test.AnonymousClass1 */

            public void run() {
                MFS100CodeHubs.this.SetTextOnUIThread("");
                MFS100CodeHubs.this.isCaptureRunning = true;
                try {
                    FingerData fingerData = new FingerData();
                    int ret = MFS100CodeHubs.this.mfs100.AutoCapture(fingerData, MFS100CodeHubs.this.timeout, MFS100CodeHubs.this.cbFastDetection.isChecked());
                    Log.e("StartSyncCapture.RET", "" + ret);
                    if (ret != 0) {
                        MFS100CodeHubs.this.SetTextOnUIThread(MFS100CodeHubs.this.mfs100.GetErrorMsg(ret));
                    } else {
                        MFS100CodeHubs.this.lastCapFingerData = fingerData;
                        final Bitmap bitmap = BitmapFactory.decodeByteArray(fingerData.FingerImage(), 0, fingerData.FingerImage().length);
                        MFS100CodeHubs.this.runOnUiThread(new Runnable() {
                            /* class MFS100Test.AnonymousClass1.AnonymousClass1 */

                            public void run() {
                                MFS100CodeHubs.this.imgFinger.setImageBitmap(bitmap);
                            }
                        });
                        MFS100CodeHubs.this.SetTextOnUIThread("Capture Success");
                        MFS100CodeHubs.this.SetLogOnUIThread("\nQuality: " + fingerData.Quality() + "\nNFIQ: " + fingerData.Nfiq() + "\nWSQ Compress Ratio: " + fingerData.WSQCompressRatio() + "\nImage Dimensions (inch): " + fingerData.InWidth() + "\" X " + fingerData.InHeight() + "\"\nImage Area (inch): " + fingerData.InArea() + "\"\nResolution (dpi/ppi): " + fingerData.Resolution() + "\nGray Scale: " + fingerData.GrayScale() + "\nBits Per Pixal: " + fingerData.Bpp() + "\nWSQ Info: " + fingerData.WSQInfo());
                        MFS100CodeHubs.this.SetData2(fingerData);
                    }
                } catch (Exception e) {
                    MFS100CodeHubs.this.SetTextOnUIThread("Error");
                } catch (Throwable th) {
                    MFS100CodeHubs.this.isCaptureRunning = false;
                    throw th;
                }
                MFS100CodeHubs.this.isCaptureRunning = false;
            }
        }).start();
    }

    private void StopCapture() {
        try {
            this.mfs100.StopAutoCapture();
        } catch (Exception e) {
            SetTextOnUIThread("Error");
        }
    }

    private void ExtractANSITemplate() {
        try {
            if (this.lastCapFingerData == null) {
                SetTextOnUIThread("Finger not capture");
                return;
            }
            byte[] tempData = new byte[2000];
            int dataLen = this.mfs100.ExtractANSITemplate(this.lastCapFingerData.RawData(), tempData);
            if (dataLen > 0) {
                byte[] ansiTemplate = new byte[dataLen];
                System.arraycopy(tempData, 0, ansiTemplate, 0, dataLen);
                WriteFile("ANSITemplate.ansi", ansiTemplate);
                SetTextOnUIThread("Extract ANSI Template Success");
            } else if (dataLen == 0) {
                SetTextOnUIThread("Failed to extract ANSI Template");
            } else {
                SetTextOnUIThread(this.mfs100.GetErrorMsg(dataLen));
            }
        } catch (Exception e) {
            Log.e("Error", "Extract ANSI Template Error", e);
        }
    }

    private void ExtractISOImage() {
        try {
            if (this.lastCapFingerData == null) {
                SetTextOnUIThread("Finger not capture");
                return;
            }
            byte[] tempData = new byte[((this.mfs100.GetDeviceInfo().Width() * this.mfs100.GetDeviceInfo().Height()) + 1078)];
            int dataLen = this.mfs100.ExtractISOImage(this.lastCapFingerData.RawData(), tempData, 2);
            if (dataLen > 0) {
                byte[] isoImage = new byte[dataLen];
                System.arraycopy(tempData, 0, isoImage, 0, dataLen);
                WriteFile("ISOImage.iso", isoImage);
                SetTextOnUIThread("Extract ISO Image Success");
            } else if (dataLen == 0) {
                SetTextOnUIThread("Failed to extract ISO Image");
            } else {
                SetTextOnUIThread(this.mfs100.GetErrorMsg(dataLen));
            }
        } catch (Exception e) {
            Log.e("Error", "Extract ISO Image Error", e);
        }
    }

    private void ExtractWSQImage() {
        try {
            if (this.lastCapFingerData == null) {
                SetTextOnUIThread("Finger not capture");
                return;
            }
            byte[] tempData = new byte[((this.mfs100.GetDeviceInfo().Width() * this.mfs100.GetDeviceInfo().Height()) + 1078)];
            int dataLen = this.mfs100.ExtractWSQImage(this.lastCapFingerData.RawData(), tempData);
            if (dataLen > 0) {
                byte[] wsqImage = new byte[dataLen];
                System.arraycopy(tempData, 0, wsqImage, 0, dataLen);
                WriteFile("WSQ.wsq", wsqImage);
                SetTextOnUIThread("Extract WSQ Image Success");
            } else if (dataLen == 0) {
                SetTextOnUIThread("Failed to extract WSQ Image");
            } else {
                SetTextOnUIThread(this.mfs100.GetErrorMsg(dataLen));
            }
        } catch (Exception e) {
            Log.e("Error", "Extract WSQ Image Error", e);
        }
    }

    private void UnInitScanner() {
        try {
            int ret = this.mfs100.UnInit();
            if (ret != 0) {
                SetTextOnUIThread(this.mfs100.GetErrorMsg(ret));
                return;
            }
            SetLogOnUIThread("Uninit Success");
            SetTextOnUIThread("Uninit Success");
            this.lastCapFingerData = null;
        } catch (Exception e) {
            Log.e("UnInitScanner.EX", e.toString());
        }
    }

    private void WriteFile(String filename, byte[] bytes) {
        try {
            String path = Environment.getExternalStorageDirectory() + "//FingerData";
            File file = new File(path);
            if (!file.exists()) {
                file.mkdirs();
            }
            String path2 = path + "//" + filename;
            File file2 = new File(path2);
            if (!file2.exists()) {
                file2.createNewFile();
            }
            FileOutputStream stream = new FileOutputStream(path2);
            stream.write(bytes);
            stream.close();
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }

    private void WriteFileString(String filename, String data) {
        try {
            String path = Environment.getExternalStorageDirectory() + "//FingerData";
            File file = new File(path);
            if (!file.exists()) {
                file.mkdirs();
            }
            String path2 = path + "//" + filename;
            File file2 = new File(path2);
            if (!file2.exists()) {
                file2.createNewFile();
            }
            FileOutputStream stream = new FileOutputStream(path2);
            OutputStreamWriter writer = new OutputStreamWriter(stream);
            writer.write(data);
            writer.flush();
            writer.close();
            stream.close();
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }

    private void ClearLog() {
        this.txtEventLog.post(new Runnable() {
            /* class MFS100Test.AnonymousClass2 */

            public void run() {
                try {
                    MFS100CodeHubs.this.txtEventLog.setText("", TextView.BufferType.EDITABLE);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void SetTextOnUIThread(final String str) {
        this.lblMessage.post(new Runnable() {
            /* class MFS100Test.AnonymousClass3 */

            public void run() {
                try {
                    MFS100CodeHubs.this.lblMessage.setText(str);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void SetLogOnUIThread(final String str) {
        this.txtEventLog.post(new Runnable() {
            /* class MFS100Test.AnonymousClass4 */

            public void run() {
                try {
                    EditText editText = MFS100CodeHubs.this.txtEventLog;
                    editText.append("\n" + str);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public void SetData2(FingerData fingerData) {
        try {
            if (this.scannerAction.equals(ScannerAction.Capture)) {
                this.Enroll_Template = new byte[fingerData.ISOTemplate().length];
                System.arraycopy(fingerData.ISOTemplate(), 0, this.Enroll_Template, 0, fingerData.ISOTemplate().length);
            } else if (this.scannerAction.equals(ScannerAction.Verify)) {
                if (this.Enroll_Template != null) {
                    this.Verify_Template = new byte[fingerData.ISOTemplate().length];
                    System.arraycopy(fingerData.ISOTemplate(), 0, this.Verify_Template, 0, fingerData.ISOTemplate().length);
                    int ret = this.mfs100.MatchISO(this.Enroll_Template, this.Verify_Template);
                    if (ret < 0) {
                        SetTextOnUIThread("Error: " + ret + "(" + this.mfs100.GetErrorMsg(ret) + ")");
                    } else if (ret >= 96) {
                        SetTextOnUIThread("Finger matched with score: " + ret);
                    } else {
                        SetTextOnUIThread("Finger not matched, score: " + ret);
                    }
                } else {
                    return;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            WriteFile("Raw.raw", fingerData.RawData());
            WriteFile("Bitmap.bmp", fingerData.FingerImage());
            WriteFile("ISOTemplate.iso", fingerData.ISOTemplate());
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override // com.mantra.mfs100.MFS100Event
    public void OnDeviceAttached(int vid, int pid, boolean hasPermission) {
        if (SystemClock.elapsedRealtime() - this.mLastAttTime >= Threshold) {
            this.mLastAttTime = SystemClock.elapsedRealtime();
            if (!hasPermission) {
                SetTextOnUIThread("Permission denied");
            } else if (vid != 1204 && vid != 11279) {
            } else {
                if (pid == 34323) {
                    try {
                        int ret = this.mfs100.LoadFirmware();
                        if (ret != 0) {
                            SetTextOnUIThread(this.mfs100.GetErrorMsg(ret));
                        } else {
                            SetTextOnUIThread("Load firmware success");
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else if (pid == 4101) {
                    int ret2 = this.mfs100.Init();
                    if (ret2 == 0) {
                        showSuccessLog("Without Key");
                    } else {
                        SetTextOnUIThread(this.mfs100.GetErrorMsg(ret2));
                    }
                }
            }
        }
    }

    private void showSuccessLog(String key) {
        try {
            SetTextOnUIThread("Init success");
            SetLogOnUIThread("\nKey: " + key + "\nSerial: " + this.mfs100.GetDeviceInfo().SerialNo() + " Make: " + this.mfs100.GetDeviceInfo().Make() + " Model: " + this.mfs100.GetDeviceInfo().Model() + "\nCertificate: " + this.mfs100.GetCertification());
        } catch (Exception e) {
        }
    }

    @Override // com.mantra.mfs100.MFS100Event
    public void OnDeviceDetached() {
        try {
            if (SystemClock.elapsedRealtime() - this.mLastDttTime >= Threshold) {
                this.mLastDttTime = SystemClock.elapsedRealtime();
                UnInitScanner();
                SetTextOnUIThread("Device removed");
            }
        } catch (Exception e) {
        }
    }

    @Override // com.mantra.mfs100.MFS100Event
    public void OnHostCheckFailed(String err) {
        try {
            SetLogOnUIThread(err);
            Toast.makeText(getApplicationContext(), err, 1).show();
        } catch (Exception e) {
        }
    }
}

 

  • activity_mfs100_sample.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    tools:context="com.ThecodeHubsDemo.FingerprintScanner.MFS100CodeHubs" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:orientation="vertical"
        android:paddingTop="0dp" >

        <TextView
            android:id="@+id/lblTitle"
            style="@style/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/title"
            android:gravity="center"
            android:padding="5dp"
            android:text="@string/app_title"
            android:textSize="20sp"
            android:textStyle="bold"
            android:visibility="gone"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:orientation="vertical"
        android:paddingTop="5dp" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:orientation="horizontal"
            android:paddingLeft="10dp"
            android:paddingRight="10dp" >

            <ImageView
                android:id="@+id/imgFinger"
                android:layout_width="100dp"
                android:layout_height="120dp"
                android:background="@drawable/imagefinger"
                android:contentDescription="@string/app_name"
                android:scaleType="fitXY"
                android:src="@drawable/finger" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingLeft="5dp" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <Button
                        android:id="@+id/btnInit"
                        style="@style/buttonbig2"
                        android:background="@drawable/button"
                        android:onClick="onControlClicked"
                        android:text="@string/Init" />

                    <Button
                        android:id="@+id/btnUninit"
                        style="@style/buttonbig2"
                        android:background="@drawable/button"
                        android:onClick="onControlClicked"
                        android:text="@string/UnInit" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <Button
                        android:id="@+id/btnSyncCapture"
                        style="@style/buttonbig2"
                        android:background="@drawable/button"
                        android:onClick="onControlClicked"
                        android:text="@string/SyncCapture" />

                    <Button
                        android:id="@+id/btnStopCapture"
                        style="@style/buttonbig2"
                        android:background="@drawable/button"
                        android:onClick="onControlClicked"
                        android:text="@string/StopSyncCapture" />
                </LinearLayout>

                <CheckBox
                    android:id="@+id/cbFastDetection"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingLeft="5dp"
                    android:text="Fast Finger Detection"
                    android:textColor="@android:color/black"
                    android:textSize="15sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="1dp"
            android:orientation="horizontal"
            android:paddingLeft="10dp"
            android:paddingRight="10dp" >

            <Button
                android:id="@+id/btnMatchISOTemplate"
                style="@style/buttonbig2"
                android:background="@drawable/button"
                android:onClick="onControlClicked"
                android:text="@string/MatchISO" />

            <Button
                android:id="@+id/btnExtractISOImage"
                style="@style/buttonbig2"
                android:background="@drawable/button"
                android:onClick="onControlClicked"
                android:text="EXTRACT ISO" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="1dp"
            android:orientation="horizontal"
            android:paddingLeft="10dp"
            android:paddingRight="10dp" >

            <Button
                android:id="@+id/btnExtractAnsi"
                style="@style/buttonbig2"
                android:background="@drawable/button"
                android:onClick="onControlClicked"
                android:text="EXTRACT ANSI" />

            <Button
                android:id="@+id/btnExtractWSQImage"
                style="@style/buttonbig2"
                android:background="@drawable/button"
                android:onClick="onControlClicked"
                android:text="EXTRACT WSQ" />

        </LinearLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="top"
        android:orientation="vertical"
        android:paddingBottom="3dp"
        android:paddingTop="5dp" >

        <TextView
            android:id="@+id/lblMessage"
            style="@style/message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/message"
            android:gravity="center"
            android:padding="5dp"
            android:text=""
            android:textSize="15dp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/txtEventLog"
            style="@style/message"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.70"
            android:background="@drawable/message"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:gravity="top|left"
            android:inputType="textMultiLine"
            android:padding="5dp"
            android:text=""
            android:textSize="14dp" />

        <Button
            android:id="@+id/btnClearLog"
            style="@style/buttonfull"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/button"
            android:onClick="onControlClicked"
            android:text="@string/ClearLog" />
    </LinearLayout>

</LinearLayout>
  • styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>


    <style name="title">
        <item name="android:padding">0dp</item>
        <item name="android:layout_margin">1dp</item>
        <item name="android:textColor">#FFFFFF </item>
    </style>

    <style name="message">
        <item name="android:padding">0dp</item>
        <item name="android:layout_margin">1dp</item>
        <item name="android:textColor">#000000 </item>
    </style>

    <style name="button">
        <item name="android:padding">0dp</item>
        <item name="android:layout_width">86dp</item>
        <item name="android:layout_height">35dp</item>
        <item name="android:layout_margin">1dp</item>
        <item name="android:textColor">#FFFFFF </item>
    </style>

    <style name="buttonbig">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">0dp</item>
        <item name="android:layout_weight">1</item>
        <item name="android:layout_margin">5dp</item>
        <item name="android:textColor">#FFFFFF </item>
    </style>

    <style name="buttonbig2">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_weight">1</item>
        <item name="android:layout_height">35dp</item>
        <item name="android:layout_margin">1dp</item>
        <item name="android:textColor">#FFFFFF </item>
    </style>

    <style name="buttonbig3">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">45dp</item>
        <item name="android:layout_margin">3dp</item>
        <item name="android:textColor">#FFFFFF </item>
    </style>

    <style name="buttonfull">
        <item name="android:padding">0dp</item>
        <item name="android:layout_height">35dp</item>
        <item name="android:layout_margin">1dp</item>
        <item name="android:textColor">#FFFFFF </item>
    </style>

    <style name="Theme.Transparent" parent="android:Theme">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:backgroundDimEnabled">false</item>
    </style>

</resources>
  • string.xml

<resources>
    <string name="app_name">Mantra (MFS100) TheCodeHubs Demo</string>
    <string name="action_settings">Settings</string>
    <string name="app_title">MANTRA-MFS100-TEST</string>
    <string name="Init">INIT</string>
    <string name="UnInit">UNINIT</string>
    <string name="ExtractISO">ISO(FMR)</string>
    <string name="ExtractWSQ">WSQ</string>
    <string name="MatchISO">MATCH ISO</string>
    <string name="MatchMinutiaeISO">MATCH Minutiae ISO</string>
    <string name="foorLoop">Init/Uninit</string>
    <string name="ClearLog">CLEAR LOG</string>
    <string name="SyncCapture">CAPTURE</string>
    <string name="StopSyncCapture">STOP CAP</string>
    <string name="WriteBit">Write Bit</string>
    <string name="ReadBit">Read Bit</string>
    <string name="ChangeKey">Change Key</string>
    <string name="GetKey">Get Key</string>

    <string-array name="MFS100Ver">
        <item>41</item>
        <item>31</item>
    </string-array>

    <string name="title_activity_preference">Preference</string>
</resources>

Now you can run your project.
Congratulations!!! you have developed your Mantra (MFS 100) Biometric fingerprint scanner Android Example Integration. in Android Studio and now just keep following the rest of the tutorial step by step to become a great Android Developer. All the very best.

 

Output:-

Download mantra mfs100 Demo project file in : –https://github.com/Keyur88/Mantra_MFS_100_Biometric.git

 

Thank You For Visiting Us.

1 Comment

  1. Amarbir Singh

    this.mfs100 = new MFS100(this);
    // Cannot resolve constructor ‘MFS100(com.app.aeps.MainActivity)’

    0
    0
    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories