B4A Library SPass - Samsung Fingerprint SDK

I have wrapped the Samsung Fingerprint SDK library. This allows you to use the fingerprint sensor built into the Samsung Galaxy S5 and S6 (and no doubt more to come). I have tested on the S6; I don't have an S5 but I believe it will work the same...

Documentation

SPass
Author:
BarxDroid
Version: 1.10
  • SPass

    Permissions:
    • com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY

    Events:
    • Completed ()
      Called when the request of identify is completed after finger is detached on the sensor.
    • Finished (StatusCode As Int, Message As String)
      Called once the Identy operation has finished
    • Ready ()
      Called once the device is ready to detect a fingerprint
    • Registered ()
      Called when a new fingerprint has been registered
    • Started ()
      Called when the user touches the fingerprint sensor during an Identify operation

    Fields:
    • STATUS_AUTHENTICATION_FAILED As Int
    • STATUS_AUTHENTICATION_PASSWORD_SUCCESS As Int
    • STATUS_AUTHENTICATION_SUCCESS As Int
    • STATUS_BUTTON_PRESSED As Int
    • STATUS_OPERATION_DENIED As Int
    • STATUS_QUALITY_FAILED As Int
    • STATUS_SENSOR_FAILED As Int
    • STATUS_TIMEOUT_FAILED As Int
    • STATUS_USER_CANCELLED As Int
    • STATUS_USER_CANCELLED_BY_TOUCH_OUTSIDE As Int

    Methods:
    • CancelIdentify
      Cancels an existing identification operation
    • HasRegisteredFinger As Boolean
      Checks whether there are any registered fingerprints on the device
    • Initialize (Eventname As String)
      Initializes the object.
      Eventname - the eventname used to call events.
    • RegisterFinger
      Registers a fingerpring on the device through the Enroll screen of the Setting menu.
    • StartIdentify (Dialog As Boolean, EnablePassword As Boolean)
      Requests an Identification Operation to recognize a fingerprint.
      Dialog - Sets whether a dialog should be shown
    • SupportsSpass As Boolean
      Returns whether a compatible fingerprint device is detected
    • setDialogTitle (Title As String, Color As Int)
      Adds a title in the user interface before requesting fingerprint recognition
    • DialogButton (Text As String)
      Changes the purpose of the UI Password button, so you can use it yourself.
      Use this method to set the text of the button.

      Will return STATUS_BUTTON_PRESSED in the _Finished Event
    • ChangeStandbyString (Text As String)
      Changes the Standby String in the interface

    Properties:
    • CanceledOnTouchOutside As Boolean [write only]
      Determines whether the UI is dismissed or not when touching background elements
    • DialogBgTransparency As Int [write only]
      Sets the transparency og the background elements before requesting fingerprint recognition
    • DialogIcon As String [write only]
      Adds an Icon in the bottom left portion of the UI before requesting fingerprint recognition
      Icon - a String representing a file stored in /res/drawable/...
      Note: No extension is needed and the file must be read only
    • IdentifiedFingerprintIndex As Int [read only]
      Gets the fingerprint index of the identified fingerprint
    • IntendedFingerprintIndex() As Integer [write only]
      Specifies a fingerprint index for identification before requesting fingerprint recognition
    • RegisteredFingerprints As Map [read only]
      Obtain a list of registered fingerprint indexes and names in the settings menu
    • Is PasswordEnabled As Boolean [read only]
      Checks if the device supports backup password
    • GetGuideForPoorQuality As String [read only]
      Obtains the string of guide when recognition is failed due to the poor quality.
      NOTE: The _Finished event must have returned 'STATUS_QUALITY_FAILED'

Change log
V1.0
Initial Release

V1.10
- Added Completed() Event
- Added STATUS_BUTTON_PRESSED Field
- Added STATUS_OPERATION_DENIED Field
- Added DialogButton Method
- Added ChangeStandbyString Method
- Added GetGuideForPoorQuality
- Added IsPasswrdEnabled Property

Installation
There are a couple of steps here as it is a wrapper for the existing SDK. I have no idea if the sdk files can be packaged within the wrapper .jar. Maybe someone can let me know if they can.
Step 1: Download the attached SPass.zip, extract the files into your Additional Libraries folder.
Step 2: Download the SDK files from Here (V1.1.3 at time of writing) and extract the lib files ('sdk-vx.x.x.jar' and 'pass-vx.x.x.jar' to you additional libraries folder.
Step 3: Rename the files as follows
sdk-vx.x.x.jar -> spass-sdk.jar
pass-vx.x.x.jar -> spass-lib.jar
Done, use it now like any other lib....

Files

Spass.apk - Example app showing a basic usage.
SPass.Zip - The Wrapper library files.
SPass Project.zip - The sample project that creates the Spass.apk sample

Hope this library is of use to some people.....
 

Attachments

  • Spass.apk
    125.2 KB · Views: 613
  • SPass-Project.zip
    75.7 KB · Views: 707
  • SPass V1.1.zip
    7.8 KB · Views: 705
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Hope this library is of use to some people.....
Today i will get my new device, a S6 Edge :)

I´m sure i will test your library soon :D

Thank you for sharing!
 

Indy

Active Member
Licensed User
Longtime User
Hi,

Just wanted to say the test apk works on my Samsung Tab S2 9.7" WiFi edition. Results were exactly same as video. Also, I noticed that Samsung have released version 1.1.4 of the SDK. Any plans to update the library to use that?

Thanks
 

barx

Well-Known Member
Licensed User
Longtime User
Hi,

Just wanted to say the test apk works on my Samsung Tab S2 9.7" WiFi edition. Results were exactly same as video. Also, I noticed that Samsung have released version 1.1.4 of the SDK. Any plans to update the library to use that?

Thanks

Thanks for reporting back great news. I can certainly look at the new version of the SDK. ;)
 

barx

Well-Known Member
Licensed User
Longtime User
Looking at changelog for 1.1.4, it is just stability enhancements, there are no changes to the methods / functions in the sdk so simply downloading 1.1.4 instead of 1.1.3 should work fine. don't forget to rename the files as stated in the original post (it is this situation why I added this step) ;)
 

Hector S. Dominguez

New Member
Licensed User
Looking at changelog for 1.1.4, it is just stability enhancements, there are no changes to the methods / functions in the sdk so simply downloading 1.1.4 instead of 1.1.3 should work fine. don't forget to rename the files as stated in the original post (it is this situation why I added this step) ;)
Hi, thanks for the great work that you had done here, I just downloaded the library but I realize that the pass sdk is now 1.2.1, and I'm having problems with the app, it crash when the fingerprint is scanned, this is the log using your sample

B4X:
** Activity (main) Create, isFirst = true **
Fingerprint Supported
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
Fingerprint Supported
** Activity (main) Resume **
Ready
Started
java.lang.AbstractMethodError: abstract method "void com.samsung.android.sdk.pass.SpassFingerprint$IdentifyListener.onCompleted()"
    at com.samsung.android.sdk.pass.SpassFingerprint$b.onFingerprintEvent(Unknown Source)
    at com.samsung.android.fingerprint.IFingerprintClient$Stub.onTransact(IFingerprintClient.java:59)
    at android.os.Binder.execTransact(Binder.java:446)
** Activity (main) Pause, UserClosed = true **
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
 

barx

Well-Known Member
Licensed User
Longtime User
Hi, thanks for the great work that you had done here, I just downloaded the library but I realize that the pass sdk is now 1.2.1, and I'm having problems with the app, it crash when the fingerprint is scanned, this is the log using your sample

B4X:
** Activity (main) Create, isFirst = true **
Fingerprint Supported
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
Fingerprint Supported
** Activity (main) Resume **
Ready
Started
java.lang.AbstractMethodError: abstract method "void com.samsung.android.sdk.pass.SpassFingerprint$IdentifyListener.onCompleted()"
    at com.samsung.android.sdk.pass.SpassFingerprint$b.onFingerprintEvent(Unknown Source)
    at com.samsung.android.fingerprint.IFingerprintClient$Stub.onTransact(IFingerprintClient.java:59)
    at android.os.Binder.execTransact(Binder.java:446)
** Activity (main) Pause, UserClosed = true **
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)

Hi I have downloaded the latest and will hopefully get time to look at it later today or in the morning.

Cheers
 

barx

Well-Known Member
Licensed User
Longtime User
Hi, thanks for the great work that you had done here, I just downloaded the library but I realize that the pass sdk is now 1.2.1, and I'm having problems with the app, it crash when the fingerprint is scanned, this is the log using your sample

B4X:
** Activity (main) Create, isFirst = true **
Fingerprint Supported
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
Fingerprint Supported
** Activity (main) Resume **
Ready
Started
java.lang.AbstractMethodError: abstract method "void com.samsung.android.sdk.pass.SpassFingerprint$IdentifyListener.onCompleted()"
    at com.samsung.android.sdk.pass.SpassFingerprint$b.onFingerprintEvent(Unknown Source)
    at com.samsung.android.fingerprint.IFingerprintClient$Stub.onTransact(IFingerprintClient.java:59)
    at android.os.Binder.execTransact(Binder.java:446)
** Activity (main) Pause, UserClosed = true **
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)

If you download the V1.1 file from the first post, all should be fixed.

Cheers
 

mr23

Active Member
Licensed User
Longtime User
Just tried this. Getting a byte code conversion problem?
Suggestion?
Just downloaded the materials.

Thanks,
-Chris

B4X:
B4A version: 5.50
Parsing code.    (0.00s)
Compiling code.    (0.02s)
Compiling layouts code.    (0.00s)
Generating R file.    (0.06s)
Compiling generated Java code.    (0.87s)
Convert byte code - optimized dex.    Error
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.a) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.c) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.e) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.b) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.d) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.a) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.b) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.c) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.d) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.samsung.android.sdk.pass.e) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/Spass;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/a;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/b;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/SpassFingerprint$a;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/c;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/SpassFingerprint$b;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/d;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/e;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/samsung/android/sdk/pass/SpassFingerprint$c;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
    at com.android.dx.command.dexer.Main.run(Main.java:277)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)
Caused by: java.lang.InterruptedException: Too many errors
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
    ... 4 more
 
Last edited:

Octavio Diaz

Member
Licensed User
Longtime User
Hello, the app works fine, but only have the option of 4 fingerprint to match? If I want to put more fingerprints on my device (Samsung) it's posible? someone? Thanks a lot!
 
Top