Fetching contributors…
Cannot retrieve contributors at this time
163 lines (120 sloc) 5.25 KB


You have to connect the SDK callback function to the communication function on Android for using android SFM_SDK.(See the below for details). Android sfm-sdk was made by C language and compiled using NDK. We currently provide SFM_SDK beta version 1.0.

!!!Tip You can download all about android SFM_SDK(library, example project, document) through below github URL.

Quick start

Step 1
Download these files.
UnifingerUI for Android.docx

!!! note is a library file for 64bits arm processor. is a library file for arm processor V7 or more up version. is a library file for arm processor V5 or V6. is a header files for library.
UnifingerUI for Android.docx is a file for documentation of android library.

Step 2
Create a android project.

Step 3
Add library files on your project.

!!! Note jnilib folder does not exist. Just make it.(you can use any name).

Step 4
Unzip And add header files in jni folder.

Step 5
Implement write call back function in java.

private int SendPacketCallback(String var)throws InterruptedException, ExecutionException, TimeoutException{
    int returnSize = SendPacket(var);
    return returnSize;

public int SendPacket(String var) throws InterruptedException, ExecutionException, TimeoutException {
    int returnSize =0;
    byte[] sendPacket = new BigInteger(var,16).toByteArray();
    try {
    } catch (IOException e) {
    return returnSize;

Step 6
Implement read call back function in java.

private int ReadPacketCallback(int size, byte[] read_buffer) throws InterruptedException, TimeoutException, ExecutionException {
    int readSize = m_SerialConnect.ReadPacket(size,read_buffer);

    return readSize;

public int ReadPacket(int size, byte[] read_buffer) throws InterruptedException, ExecutionException, TimeoutException {
    long lnStart =0, lnEnd =0;
    int nTime_out = 8000;
    int returnSize = 0;
    m_nRead_len = 0;

    lnStart = SystemClock.currentThreadTimeMillis();

    do {
        tempBuffer = new byte[size - returnSize];

        Future<Integer> future = executor.submit(readTask);
        m_nRead_len = future.get(nTime_out, TimeUnit.MILLISECONDS);

        if (m_nRead_len > 0) {
            System.arraycopy(tempBuffer, 0, read_buffer, returnSize, m_nRead_len);
            returnSize += m_nRead_len;

        lnEnd = SystemClock.currentThreadTimeMillis();
    } while (returnSize < size && ((lnEnd - lnStart) < nTime_out));


Callable<Integer> readTask = new Callable<Integer>() {
    public Integer call() throws Exception {
        int retSize = 0;

        do {
            retSize =;
        } while (retSize <= 0);

        return retSize;

!!! tip Write/Read callback funciotn is used in SFM_SDK. It means SFM_SDK calls these function to communication with module. So you have to create proper Write/Read callback funciotn(Keep parameter type and return type). And then connect these functions using setting functions like step 7.

Step 7
Connect to communication function(write/read callback) with SDK using JNI.


!!! Note SetCommandClassName()'s parameter is JNI class name that is made by you.

Now, You can use SFM library in JNI class that is made by you.

Step 8
Build your program. Then run.

!!! Note If you want more detail explanation to use library and work environment or about license refer to documentation

Example code

How to call identify function?

JNIEXPORT jint JNICALL Java_com_suprema_www_unifingerui_Command_UF_1Identify  (JNIEnv * env, jobject obj)
    int result=0;
    unsigned int userID=0;
    unsigned char subID=0;

        return -1;


    return result;