[ARCHIVED] FingerAuth
Fingerprint authentication made easy.
Releases:
Current release: 1.0.1.
You can see all the library releases here.
Screenshots
FingerAuthDialog | onSuccess | onFailure |
---|---|---|
Download the sample apk here.
Usage:
Adding the depencency
Add this to your root build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Now add the dependency to your app build.gradle file:
implementation 'com.github.marcoscgdev:FingerAuth:1.0.1'
Creating a dialog
Here is a complete snippet of it usage:
new FingerAuthDialog(this)
.setTitle("Sign in")
.setCancelable(false)
.setMaxFailedCount(3) // Number of attemps, default 3
.setPositiveButton("Use password", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// do something
}
})
.setOnFingerAuthListener(new FingerAuth.OnFingerAuthListener() {
@Override
public void onSuccess() {
Toast.makeText(MainActivity.this, "onSuccess", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure() {
Toast.makeText(MainActivity.this, "onFailure", Toast.LENGTH_SHORT).show();
}
@Override
public void onError() {
Toast.makeText(MainActivity.this, "onError", Toast.LENGTH_SHORT).show();
}
})
.show();
Show dialog only on devices that support fingerprint auth:
boolean hasFingerprintSupport = FingerAuth.hasFingerprintSupport(this);
if (hasFingerprintSupport)
fingerAuthDialog.show();
Implementing your own method
new FingerAuth(this)
.setMaxFailedCount(3) // Number of attemps, default 3
.setOnFingerAuthListener(new FingerAuth.OnFingerAuthListener() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onFailure() {
// do something
}
@Override
public void onError() {
// do something
}
});
Override strings
<string name="fingerauth_dialog_description">Confirm fingerprint to continue</string>
<string name="fingerauth_dialog_hint">Touch sensor</string>
<string name="fingerauth_dialog_not_recognized">Fingerprint not recognized. Try again</string>
<string name="fingerauth_dialog_success">Fingerprint recognized</string>
See the sample project to clarify any queries you may have.
License
Copyright 2018 Marcos Calvo García
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.