ProgrammingGuide Pass-1.2.2
ProgrammingGuide Pass-1.2.2
Programming Guide
Version 1.2.2
2. Architecture ........................................................................................................................................................ 4
Copyright .................................................................................................................................................................. 22
recognize fingerprints
cancel recognition requests
check whether a registered fingerprint exists on the device
register fingerprints through the Enroll screens of the Setting menu
get fingerprint index upon recognition success
get list of names and indexes of registered fingerprints
get list of names or unique IDs of registered fingerprints with their indexes
specify an index for fingerprint recognition
add title to the user interface
add logo to the user interface
set the transparency of background elements
set dialog behavior when background elements are touched
broadcasts from the device when registered fingerprint is changed
get the guide for the poor quality
set the button for the user interface
change the standby string for the user interface
The following permission has to be specified in the AndroidManifest.xml file to initialize Pass.
<uses-permission android:name=
"com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"/>
@Override
public void onFinished(int eventStatus) {
// It is called when fingerprint identification is finished.
if (eventStatus == SpassFingerprint.STATUS_AUTHENTIFICATION_SUCCESS) {
// Identify operation succeeded with fingerprint
@Override
public void onReady() {
// It is called when fingerprint identification is ready after
// startIdentify() is called.
}
@Override
public void onStarted() {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
mSpass = new Spass();
try {
mSpass.initialize(SampleActivity.this);
} catch (SsdkUnsupportedException e) {
// Error handling
} catch (UnsupportedOperationException e){
// Error handling
}
isFeatureEnabled = mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT);
if(isFeatureEnabled){
mSpassFingerprint = new SpassFingerprint(SampleActivity.this);
} else {
log("Fingerprint Service is not supported in the device.");
}
}
Initializing should be implemented just once before accessing SpassFingerprint class. If the Pass package
fails to initialize or if the device does not support Pass, the initialize() method throws an
SsdkUnsupportedException exception. To find out the reason for the exception, you can check it through
the exception message.
DEVICE_FINGERPRINT: indicates if the device supports the default identification requests and the
user interface
DEVICE_FINGERPRINT_FINGER_INDEX: indicates if the API allows you to set a specified fingerprint
using its index for fingerprint recognition
DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG: indicates the API for defining a custom user interface
DEVICE_FINGERPRINT_UNIQUE_ID: indicates the API for getting index and fingerprint unique IDs
The isFeatureEnabled() method returns a Boolean value that indicates the support for the feature on
the device.
boolean isFeatureEnabled(int type)
registerFinger(): registers a fingerprint on the device through the Enroll screen of the Setting
menu
getIdentifiedFingerprintIndex():obtains the fingerprint index of the identified
fingerprint when recognition is a success
getRegisteredFingerprintName(): obtains a list of registered fingerprint
indexes and names in the Settings menu
setIntendedFingerprintIndex(): specifies a fingerprint index for identification
before requesting fingerprint recognition
setDialogTitle() : adds a title in the user interface before requesting fingerprint recognition
setDialogIcon() : adds a logo in the bottom left portion of the UI before requesting fingerprint
recognition
setDialogBgTransparency() : sets the transparency of background elements before requesting
fingerprint recognition
setCanceledOnTouchOutside() : sets a value that determines whether the user interface is
dismissed or not when touching background elements before requesting fingerprint recognition
getGuideForPoorQuaility() : obtains the string of guide when recognition is failed due to the poor quality.
setDialogButton() : adds the button in the user interface for connecting own menu after the user interface is
dismissed.
changeStandbyString() : changes the standby string as own in the user interface.
The method returns true if a registered fingerprint exists on the device and returns false if no registered
fingerprint is found.
onStarted(): called when the user touches the fingerprint sensor and starts to swipe their finger
If your application uses the identify operation with a UI, you should check if the device supports backup
password after calling mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD)
first and if the device supports it, you have the additional option of using a password instead of a
fingerprint for identification. To show the Password button on the UI, set enablePassword to true. To hide
the button and use only fingerprint identification, set enablePassword to false.
Both startIdentify () and startIdentifyWithDialog () methods follow the policy of device fingerprint
recognition. So the operation is different depending on each device.
In some devices, fingerprint recognition is denied after 5 failed attempts. Afterwards, only password
verification requests will be allowed with unlimited attempts in the device which support the backup
password. However, an SpassInvalidStateException occurs per request if a timer is introduced for
lockout.
When the identify operation is requested, the fingerprint sensor enters the Ready state. When the
startIdentify() or startIdentifyWithDialog() operations are finished, the onFinished() method of
IdentifyListener is called and passes the event status that allows you to verify the result of the identify
operation:
If there is no activity for 20 seconds after the fingerprint sensor enters the Ready state, the request
is canceled, and the onFinished() method is called with the event status,
STATUS_TIMEOUT_FAILED.
If the device is support backup password and the backup password matches, the event status is
STATUS_AUTHENTIFICATION_PASSWORD_SUCCESS.
If the request of identify is accepted and then identify operation is failed and a timer is started for
lockout, the onFinished() method is called with the event status,
STATUS_AUTHENTIFICATION_FAILED and STATUS_OPERATION_DENIED
If the fingerprint recognition fails, the following event status defines the reason for the failure:
o STATUS_USER_CANCELLED
o STATUS_QUALITY_FAILED
o STATUS_SENSOR_FAILED
@Override
public void onReady() {
// It is called when fingerprint identification is ready after
// startIdentify() is called.
}
@Override
public void onStarted() {
// It is called when the user touches the fingerprint sensor after
// startIdentify() is called.
}
@Override
public void onCompleted() {
//It is called when identify request is completed
}
};
mSpassFingerprint.cancelIdentify();
mSpassFingerprint.registerFinger(this, mRegisterListener);
@Override
public void onFinished() {
log("RegisterListener.onFinished()");
}
};
mSpassFingerprint.getIdentifiedFingerprintIndex();
mSpassFingerprint.getRegisteredFingerprintName ();
if (mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_UNIQUE_ID)){
mSpassFingerprint. getRegisteredFingerprintUniqueID ()
}
If the parameter to this method is set as null or no index, then the function finds a match against all
registered fingerprints. If the parameter to this method is a valid index, then the function finds a match
against the designated fingerprint.
mSpassFingerprint.setIntendedFingerprintIndex(ArrayList<Integer>);
ArrayList<Integer> designatedFingers = new ArrayList<Integer>();
designatedFingers.add(2);
designatedFingers.add(3);
if (mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_FINGER_INDEX)){
mSpassFingerprint. setIntendedFingerprintIndex (designatedFingers);
}
mSpassFingerprint.startIdentifyWithDialog(SampleActivity.this,listener, true);
Calling the setDialogTitle() method from the SpassFingerprint class allows you to set a string as a
custom title. If the string is null, then the title would not be displayed in the UI.
if(mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG)){
mSpassFingerprint.setDialogTitle("Customized Dialog", 0xff0000);
}
mSpassFingerprint.startIdentifyWithDialog(SampleActivity.this,listener, true);
The parameter of the function accepts a file name which is stored in /res/Drawable/… of the device. If the
parameter is set to null or the image cannot be found, then the method displays the default dialog without
the icon.
mSpassFingerprint.setDialogIcon(String iconName);
if(mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG)){
mSpassFingerprint.setDialogIcon("ic_launcher");
}
mSpassFingerprint.startIdentifyWithDialog(SampleActivity.this,listener, true);
mSpassFingerprint.setDialogBgTransparency(int transparency);
if(mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG)){
mSpassFingerprint.setDialogBgTransparency(0);
}
mSpassFingerprint.startIdentifyWithDialog(SampleActivity.this,listener, true);
setCanceledOnTouchOutside(boolean cancel);
if(mSpass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG)){
mSpassFingerprint.setCanceledOnTouchOutside(true);
}
mSpassFingerprint.startIdentifyWithDialog(SampleActivity.this,listener, true);
ACTION_FINGERPRINT_RESET = "com.samsung.android.intent.action.FINGERPRINT_RESET";
ACTION_FINGERPRINT_REMOVED = "com.samsung.android.intent.action.FINGERPRINT_REMOVED";
ACTION_FINGERPRINT_ADDED = "com.samsung.android.intent.action.FINGERPRINT_ADDED";
mSpassFingerprint.getGuideForPoorQuality();
Calling the setDialogButton () method from the SpassFingerprint class allows you to set a button as a
own customized button. If the string is null, then the button would not be displayed in the UI.
If the customized button is set, then the UI is dismissed and you can receive STATUS_BUTTON_PRESSED as
the event status in IdentifyListener.onFinished() and connect your own menu for alternative.
Calling the changeStandbyString() method from the SpassFingerprint class allows you to change a
standby string as a own customized string. If the string is null, then the standby string would be displayed as
default in the UI.
if(!mSpass.isFeatureEnabled(Spass. DEVICE_FINGERPRINT_AVAILABLE_PASSWORD)){
mSpassFingerprint. changeStandbyString ("Touch your fingerprint or press the button
for launching own menu”);
}
mSpassFingerprint.startIdentifyWithDialog(SampleActivity.this,listener, true);
Though every care has been taken to ensure the accuracy of this document, Samsung Electronics Co., Ltd.
cannot accept responsibility for any errors or omissions or for any loss occurred to any person, whether
legal or natural, from acting, or refraining from action, as a result of the information contained herein.
Information in this document is subject to change at any time without obligation to notify any person of
such changes.
Samsung Electronics Co. Ltd. may have patents or patent pending applications, trademarks copyrights or
other intellectual property rights covering subject matter in this document. The furnishing of this document
does not give the recipient or reader any license to these patents, trademarks copyrights or other
intellectual property rights.
No part of this document may be communicated, distributed, reproduced or transmitted in any form or by
any means, electronic or mechanical or otherwise, for any purpose, without the prior written permission of
Samsung Electronics Co. Ltd.
All brand names and product names mentioned in this document are trademarks or registered trademarks
of their respective owners.