npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-fingerprint-identify

v1.0.5

Published

A cool package for authenticate with Fingerprint sensor on Android device

Downloads

682

Readme

react-native-fingerprint-identify

Fingerprint android auth for react-native (Android only).

This is an expandable Android fingerprint API compatible lib, which also combines Samsung and MeiZu's official Fingerprint API.

Samsung and MeiZu's fingerprint SDK supports most devices which system versions less than Android 6.0.

Api priority level:Android > Samsung > MeiZu, Xiaomi,...

Demo

Getting started

$ npm install react-native-fingerprint-identify --save

Most automatic installation

$ react-native link react-native-fingerprint-identify

Make sure the following lines in android/app/build.gradle:
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
...
    defaultConfig {
      targetSdkVersion 25

Manual Installation

Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.fingerprint.identify.RNFingerprintIdentifyPackage;

    to the imports at the top of the file

  • Add new RNFingerprintIdentifyPackage()

    to the list returned by the getPackages() method

Append the following lines to android/settings.gradle:
  	include ':react-native-fingerprint-identify'
  	project(':react-native-fingerprint-identify').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fingerprint-identify/android')
Make sure the following lines in android/app/build.gradle:
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
...
    defaultConfig {
      targetSdkVersion 25
Insert the following lines inside the dependencies block in android/app/build.gradle

in dependencies block

  compile project(':react-native-fingerprint-identify')

Example

Please clone repo and look on the example project to get more details

import FingerprintIdentify from 'react-native-fingerprint-identify';
import { Platform } from 'react-native'

// Make sure you run in Android Platform condition
scanFingerprint = async () => {
  if (Platform.OS === 'android') {
    try {
      const initFingerPrintIdentify = await FingerprintIdentify.initFingerPrintIdentify()
      const isSensorAvailable = await FingerprintIdentify.isSensorAvailable()
      if (initFingerPrintIdentify && isSensorAvailable) {
        await FingerprintIdentify.startIdentify((status) => {
          console.log(status)
        })
      }
    } catch (error) {
      console.log(error)
      return
    }
  }
}

Usage

Easy custom error message with error codes.

Errors on startIdentify() function:

ERROR_NOT_AVAILABLE
ERROR_NOT_MATCH
ERROR_NOT_MATCH_AND_CHANCES_LEFT:(AvailableTimes)

Errors on isSensorAvailable() function:

ERROR_HARDWARE: The device does not support fingerprint scanning.
ERROR_ENROLLED: No fingerprints registered.
ERROR_PERMISSION: App has no permission.
ERROR_INITIALIZED: The FingerPrintIdentify can not initialize

Init FingerprintIdentify before request scan.

FingerprintIdentify.initFingerPrintIdentify()

Promise returns true if success and string error in other cases (including case when you have sensor, but not enabled it in your phone's settings)

FingerprintIdentify.isSensorAvailable()

Starting scan finger print and get the result in the callback function, returns true if success and string error in other cases.

FingerprintIdentify.startIdentify((val) => console.log(val))

Removing event listener (fingerprint identity status) - prevent crash App after authentication, usually put in componentWillUnmount()

FingerprintIdentify.dismiss()

Removing event listener to scan fingerprint and also cancel identify

FingerprintIdentify.cancelIdentify()

Troubleshooting

If you make five wrong fingerprint attempts, Android Fingerprint API requires some time to continue work on the sensor.

In that case FingerprintIdentify.startIdentify() locked out, so it would be good to make the user aware that sensor is temporarily unavailable (near 30 seconds).

Questions or suggestions?

Feel free to open an issue

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

paypal