Reprint


Source link: https://github.com/ajalt/reprint

A simple, unified fingerprint authentication library for Android with RxJava extensions.

  • Eliminates the need to deal with the different available Fingerprint APIs, including Imprint and Samsung Pass.
  • Fixes undocumented bugs and idiosyncrasies in the underlying APIs.
  • Supports more Imprint devices than FingerprintManagerCompat from the support library.
  • Comes with help messages translated in over 80 locales that work with all APIs.
  • Provides optional RxJava interfaces.

Usage

See the sample app for a complete example.

In your Application.onCreate, initialize Reprint with Reprint.initialize(this). This will load the Marshmallow module, and the Spass module if you included it.

Then, anywhere in your code, you can call Reprint.authenticate to turn on the fingerprint reader and listen for a fingerprint. You can call Reprint.cancelAuthentication to turn the reader off before it finishes normally.

There are two ways to be notified of authentication results: traditional callback, and a ReactiveX Observable.

RxJava interface

If you include the reactive reprint library, you can be notified of authentication results through an Observable (or Flowable with RxJava 2) by calling RxReprint.authenticate. In this case, the subscriber's onNext will be called after each failure and after success.

RxReprint.authenticate()
  .subscribe(result -> {

switch (result.status) {

 case SUCCESS:

  showSuccess();

  break;

 case NONFATAL_FAILURE:

  showHelp(result.failureReason, result.errorMessage);

  break;

 case FATAL_FAILURE:

  showError(result.failureReason, result.errorMessage);

  break;

}

  
}
);

The failureReason is an enum value with general categories of reason that the authentication failed. This is useful for displaying custom help messages in your UI.

The errorMessage is a string that will contain some help text provided by the underlying SDK about the failure. You should show this text to the user, or some other message of your own based on the failureReason. This string will never be null from a failure, and will be localized into the current locale.

For detail on the other parameters, see the Javadocs.

One advantage that this interface has is that when the subscriber unsubscribes, the authentication request is automatically canceled. So you could, for example, use the RxLifecycle library to bind the observable, and the authentication will be canceled when your activity pauses.

Traditional Callbacks

If you want to use Reprint without RxJava, you can pass an AuthenticationListener to authenticate. The onFailure callback will be called repeatedly until the sensor is disabled or a fingerprint is authenticated correctly, at which point onSuccess will be called.

Reprint.authenticate(new AuthenticationListener() {

  public void onSuccess(int moduleTag) {

showSuccess();

  
}

public void onFailure(AuthenticationFailureReason failureReason, boolean fatal,

CharSequence errorMessage, int moduleTag, int errorCode) {

showError(failureReason, fatal, errorMessage, errorCode);

  
}
 
}
);

Documentation

The javadocs for the Reprint modules are available online:

Installation

Reprint is distributed with jitpack and split up into several libraries, so you can include only the parts that you use.

First, add Jitpack to your gradle repositories.

repositories {

  maven {
 url "https://jitpack.io" 
}
 
}

Then add the core library and optionally the Samsung Pass interface and the ReactiveX interface. Reprint provides support for both RxJava 1 and 2; you should include the module that matches the version of RxJava that you use in your project.

dependencies {

 compile 'com.github.ajalt.reprint:core:3.2.0@aar' // required: supports marshmallow devices
 compile 'com.github.ajalt.reprint:reprint_spass:3.2.0@aar' // optional: support for pre-marshmallow Samsung devices
 compile 'com.github.ajalt.reprint:rxjava:3.2.0@aar' // optional: the RxJava 1 interface
 compile 'com.github.ajalt.reprint:rxjava2:3.2.0@aar' // optional: the RxJava 2 interface 
}

Permissions

Reprint requires the following permissions be declared in your AndroidManifest.xml. As long as you use the aar artifacts, these permissions will be included automatically.

<!-- Marshmallow fingerprint permission--> <uses-permission android:name="android.permission.USE_FINGERPRINT"/>  <!-- Samsung fingerprint permission, only required if you include the Spass module --> <uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"/>

License

Copyright 2015-2017 AJ Alt  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. 

Resources

Unofficial client for local Youtube alternative website.

RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations.

Read incoming and outgoing text messages using an Android application across different Android SDK versions it's not trivial. If yo don't want to appear as SMS application and your application has to read incoming and outgoing SMSs this is your library.

This Android library offers you two main classes to use to start listening text messages. SMS Radar is implemented in top of an Android service. To start / stop listening text messages use SmsRadar.initializeSmsRadarService(context, listener) with a Context instance and a SmsListener implementation.

Fast JSON Processor.

android-asyncservice manages threading and caching transparently in your Android app.

It's an alternative to AsyncTasks, Loaders, or more advanced libs like RxJava, Robospice, Groundy, … but AsyncService focuses on keeping your code short and simple!

BaseAdapterHelper aims to make BaseAdapter's getView() method much more readable, getting rid of the ViewHolder pattern boilerplate code.

QuickAdapter allows you to shorten the code of most usual BaseAdapter, taking care of implementing everything for you based on your data list. You only need to focus on the mapping between your view and your model.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes