All Projects → pwittchen → Rxbiometric

pwittchen / Rxbiometric

Licence: apache-2.0
☝️ RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Rxbiometric

Reactivebeacons
Android library scanning BLE beacons nearby with RxJava
Stars: ✭ 171 (-42.03%)
Mutual labels:  rxjava, rxjava2, rxandroid, rxandroid2
Reactivenetwork
Android library listening network connection state and Internet connectivity with RxJava Observables
Stars: ✭ 2,484 (+742.03%)
Mutual labels:  rxjava, rxjava2, rxandroid, rxandroid2
Rxjavapriorityscheduler
RxPS - RxJavaPriorityScheduler - A RxJava Priority Scheduler library for Android and Java applications
Stars: ✭ 138 (-53.22%)
Mutual labels:  rxjava, rxjava2, rxandroid, rxandroid2
Reactivewifi
Android library listening available WiFi Access Points and related information with RxJava Observables
Stars: ✭ 186 (-36.95%)
Mutual labels:  rxjava, rxjava2, rxandroid, rxandroid2
Swipe
👉 detects swipe events on Android
Stars: ✭ 324 (+9.83%)
Mutual labels:  rxjava, rxjava2, rxandroid, rxandroid2
ReactiveBus
🚍 Reactive Event Bus for JVM (1.7+) and Android apps built with RxJava 2
Stars: ✭ 17 (-94.24%)
Mutual labels:  rxjava, rxandroid, rxjava2, rxandroid2
Rxbus
🚌 The RxBus as steady as an old dog.
Stars: ✭ 334 (+13.22%)
Mutual labels:  rxjava, rxjava2, rxandroid, rxandroid2
Prefser
Wrapper for Android SharedPreferences with object serialization and RxJava Observables
Stars: ✭ 228 (-22.71%)
Mutual labels:  rxjava, rxjava2, rxandroid, rxandroid2
Reactivesensors
Android library monitoring device hardware sensors with RxJava
Stars: ✭ 161 (-45.42%)
Mutual labels:  rxjava, rxjava2, rxandroid
Mvvm Architecture Android Beginners
This repository contains a sample app that implements MVVM architecture using Kotlin, ViewModel, LiveData, and etc.
Stars: ✭ 176 (-40.34%)
Mutual labels:  rxjava, rxjava2, rxandroid
Rxbus
Event Bus By RxJava.
Stars: ✭ 2,126 (+620.68%)
Mutual labels:  rxjava, rxjava2, rxandroid
Dagger2
Kotlin Dagger2 example project
Stars: ✭ 145 (-50.85%)
Mutual labels:  rxjava, rxjava2, rxandroid2
Android Clean Architecture Boilerplate
Apply clean architecture on Android
Stars: ✭ 141 (-52.2%)
Mutual labels:  rxjava, rxjava2, rxandroid
Mvpframes
整合大量主流开源项目并且可高度配置化的 Android MVP 快速集成框架,支持 AndroidX
Stars: ✭ 100 (-66.1%)
Mutual labels:  rxjava, rxjava2, rxandroid
Androidbasemvp
🚀一个快速搭建MVP+RxJava2+Retrofit 基础框架,主要是封装有Http网络请求、日志、缓存、加载等待、toast、页面状态布局管理、权限、RxBus、Glide图片加载等组件,方便快速开发新项目、减少开发成本。
Stars: ✭ 184 (-37.63%)
Mutual labels:  rxjava, rxjava2, rxandroid
rxandroid2-retrofit2
Small tutorial to get started with RxAndroid 2 and Retrofit 2
Stars: ✭ 55 (-81.36%)
Mutual labels:  rxandroid, rxjava2, rxandroid2
Poolakey
Android In-App Billing SDK for Cafe Bazaar App Store
Stars: ✭ 60 (-79.66%)
Mutual labels:  rxandroid, rxjava2, rxkotlin
RxPagination
Implement pagination in just few lines with RxPagination
Stars: ✭ 20 (-93.22%)
Mutual labels:  rxandroid, rxjava2, rxkotlin
iMoney
iMoney 金融项目
Stars: ✭ 55 (-81.36%)
Mutual labels:  rxjava, rxjava2, rxandroid2
Rxkotlin Rxjava2 Android Samples
Learning RxKotlin2 for Android by Examples - Migration From RxKotlin1/RxJava1 to RxKotlin2/RxJava2 - How to use RxKotlin 2 in Android - RxLogin using RxBinding - Pagination using RxKotlin
Stars: ✭ 65 (-77.97%)
Mutual labels:  rxjava, rxkotlin, rxandroid2

logo

RxBiometric Build Status Maven Central Android Arsenal

RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android (added in Android 9 Pie, API Level 28+)

If your app is drawing its own fingerprint auth dialogs, you should switch to using the BiometricPrompt API as soon as possible.

It's an official statement from Google Android Developers Blog. RxBiometric helps you to do that via RxJava stream!

Contents

Usage

Simple library usage in Kotlin looks as follows:

RxBiometric
  .title("title")
  .description("description")
  .negativeButtonText("cancel")
  .negativeButtonListener(DialogInterface.OnClickListener { _, _ ->
    showMessage("cancel")
  })
  .executor(mainExecutor)
  .build()
  .authenticate(context)
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribeBy(
    onComplete = { showMessage("authenticated!") },
    onError = { showMessage("error") }
  )

Library also have validation method in the Preconditions class, which you can use to verify if you're able to use Biometric.

Preconditions.hasBiometricSupport(context)

There's also RxPreconditions class, which has the same method wrapped in RxJava Single<Boolean> type, which you can use to create fluent data flow like in the example below

RxPreconditions
  .hasBiometricSupport(context)
  .flatMapCompletable {
    if (!it) Completable.error(BiometricNotSupported())
    else
      RxBiometric
        .title("title")
        .description("description")
        .negativeButtonText("cancel")
        .negativeButtonListener(DialogInterface.OnClickListener { _, _ ->
          showMessage("cancel")
        })
        .executor(mainExecutor)
        .build()
        .authenticate(context)
  }
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribeBy(
    onComplete = { showMessage("authenticated!") },
    onError = {
      when (it) {
        is AuthenticationError -> showMessage("error")
        is AuthenticationFail -> showMessage("fail")
        is AuthenticationHelp -> showMessage("help")
        is BiometricNotSupported -> showMessage("biometric not supported")
        else -> showMessage("other error")
      }
    }
  )

If you want to create your own CryptoObject and use it during authentication, then you can call authenticate(context, cryptoObject) method instead of authenticate(context).

Of course, don't forget to dispose Disposable appropriately in the Activity Lifecycle.

Library can be used in the Java projects as well. Idea is the same, just syntax will be a bit different.

Examples

Complete example of the working application can be found in the kotlin-app directory.

Download

You can depend on the library through Gradle:

dependencies {
  implementation 'com.github.pwittchen:rxbiometric:0.1.0'
}

Tests

Tests are available in library/src/test/kotlin/ directory and can be executed on JVM without any emulator or Android device from Android Studio or CLI with the following command:

./gradlew test

Code style

Code style used in the project is called SquareAndroid from Java Code Styles repository by Square available at: https://github.com/square/java-code-styles.

Static code analysis

Static code analysis runs Checkstyle, PMD, Lint and Detekt. It can be executed with command:

./gradlew check

Reports from analysis are generated in library/build/reports/ directory.

JavaDoc

Documentation can be generated as follows:

./gradlew dokka

Output will be generated in library/build/javadoc

JavaDoc can be viewed on-line at https://pwittchen.github.io/RxBiometric/library/

Changelog

See CHANGELOG.md file.

Releasing

See RELEASING.md file.

Mentions

References

License

Copyright 2018 Piotr Wittchen

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].