-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
|
||
<p align="center"> | ||
<a href="#" target="_blank"> | ||
<img src="logo.png" width="64" alt="BiometricKit Fingerprint Authentication Library" /> | ||
</a> | ||
</p> | ||
|
||
|
||
|
||
[![](https://jitpack.io/v/AlexJuca/BiometrickKit.svg)](https://jitpack.io/#AlexJuca/Kiyo) | ||
|
||
BiometricKit is a simple to use and android fingerprint authentication Library written in pure kotlin for Android M (API 23) and above that follows the material design guidelines. <a href="https://material.io/design/platform-guidance/android-fingerprint.html#standard-fingerprint" target="_blank">Guidelines</a> | ||
|
||
<img src="https://raw.githubusercontent.com/AlexJuca/BiometricKit/master/demo.png" width="360" height="640"> | ||
|
||
Download | ||
-------- | ||
|
||
Download the latest version via Gradle: | ||
|
||
**Step 1:** Include jitpack to your projects build.gradle file | ||
``` | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
``` | ||
|
||
**Step 2:** Add the Kiyo dependency to your build.gradle file | ||
|
||
``` | ||
dependencies | ||
{ | ||
implementation 'com.github.AlexJuca:Biometrickit:0.0.1' | ||
} | ||
``` | ||
|
||
|
||
Usage | ||
---------- | ||
|
||
**Step 1:** Set up a BiometricKitCallback to handle callbacks. | ||
```java | ||
|
||
private val biometricKitCallback: BiometricKitCallback = object: BiometricKitCallback { | ||
override fun onSdkVersionNotSupported() { | ||
|
||
} | ||
|
||
override fun onBiometricAuthenticationNotSupported() { | ||
|
||
} | ||
|
||
override fun onBiometricAuthenticationNotAvailable() { | ||
|
||
} | ||
|
||
override fun onBiometricAuthenticationPermissionNotGranted() { | ||
|
||
} | ||
|
||
override fun onBiometricAuthenticationInternalError(error: String) { | ||
|
||
} | ||
|
||
override fun onAuthenticationFailed() { | ||
|
||
} | ||
|
||
override fun onAuthenticationCancelled() { | ||
prompt.authenticate(this, false) | ||
} | ||
|
||
override fun onAuthenticationSuccessful() { | ||
Toast.makeText(this@MainActivity, "Bought successfully", Toast.LENGTH_SHORT).show() | ||
} | ||
|
||
override fun onAuthenticationHelp(helpCode: Int, helpString: CharSequence?) { | ||
|
||
} | ||
|
||
override fun onAuthenticationError(errorCode: Int, errString: CharSequence?) { | ||
|
||
} | ||
|
||
} | ||
``` | ||
|
||
**Step 2:** | ||
|
||
```java | ||
val prompt = BiometricKit.BiometricBuilder(this as Context) | ||
.setTitle("Confirm Payment") | ||
.setSubtitle("[email protected]") | ||
.setDescription("Paying for Kamba Gas Service") | ||
.setNegativeButtonText("Cancel").setInstructions("Touch the fingerprint sensor") | ||
.build() | ||
|
||
prompt.authenticate(biometricKitCallback, true) | ||
``` | ||
|
||
## Version history | ||
``` 0.0.1: Initial Version - 28/03/2019 ``` <br/> | ||
|
||
License | ||
-------- | ||
|
||
Copyright Alexandre Antonio Juca <[email protected]> | ||
|
||
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ class MainActivity : AppCompatActivity() { | |
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
|
||
prompt = BiometricKit.BiometricBuilder(this as Context) | ||
val prompt = BiometricKit.BiometricBuilder(this as Context) | ||
.setTitle("Confirm Payment") | ||
.setSubtitle("[email protected]") | ||
.setDescription("Paying for Kamba Gas Service") | ||
|