Android pin code library

A Material design Android pincode library Supports Fingerprint

LolliPin

A Lollipop material design styled android pincode library (API 14+)

To include in your project, add this to your build.gradle file:

Starting from version 2.1.0 we will have a different package name:

Security

Password protection

The password itself is not saved, only its hash using the SHA-1 algorithm.
This hash is then saved on the SharedPreferences, allowing to verify that the user entered the right PinCode,
without giving the possibility to retrieve it.

Introducing Fingerprint

Once the user has enabled the password, he can also use his fingerprint scanner (using Google Api, not Samsung)
to unlock his device.

Usage

If you want an example on how to use it, you can find an example app in this repo.

Preparing dependencies

We are using a custom version of RippleView that contains a RippleAnimationListener.
In order to be able to fetch this dependency, you need to add these lines into your main build.gradle file:

Overriding the AppLockActivity

In order to use the «Forgot» system, we let you extend the AppLockActivity class to provide your own way of handling the user behaviour in this case (logout, delete datas etc. )

Advised to be done by extending the Application, but can be done elsewhere. The method below provides a way to enable or disable the PinCode system:

Enabling

Once enabled, you must extend «PinActivity» for every Activity you wish to protect.

Disabling

Set up the PinCode

Whenever you want the user to set up his pin code, you need to request:

Unlock system

As soon as you enable the PinCode system, the Unlock screen will appear by itself when the user resume the app after a defined timeout.
Please refer to the next section to know how to customize these values.

Customization

Some features are customizable:

The unlock timeout:

The pin length required:

The logo displayed at the top of the page:

The ignored activities:

For instance you got a login activity that you want to avoid getting the lock screen, you can ignore this activity by doing:

Читайте также:  Мой том android pdalife

The AppLockActivity Layout:

By providing a custom layout to getContentView() you can alter how your AppLockActivity looks.
However, you must include 4 required elements:

  • TextView with an id of pin_code_step_textview
  • TextView with an id of pin_code_forgot_textview
  • PinCodeRoundView with an id of pin_code_round_view
  • KeyboardView with an id of pin_code_keyboard_view

The Pin Dots:

By supplying alternate drawable resources for app:lp_empty_pin_dot and app:lp_full_pin_dot you can custimize how it looks.

Источник

Android pin code library

PasscodeView is an Android Library to easily and securely authenticate the user with the PIN code or using the fingerprint scanner.

Secure authentication is the key factor in many application (e.g. financial applications). Many application uses PIN-based authentication.

But Android System doesn’t provide any easy to set the view for PIN-based authentication which can tightly integrate and take advantage of fingerprint API introduced in newer versions of android. This limitation led me to work on this project.

With the use of PasscodeView, you can easily integrate PIN & Fingerprint based authentication in your application.

This library provides an easy and secure PIN and Pattern based authentication view, which

  • It provides access to built-in fingerprint-based authentication if the device supports fingerprint hardware. This handles all the complexities of integrating the fingerprint API with your application.
  • It provides error feedback when PIN or pattern entered is wrong.
  • Extremely lightweight.
  • Supports dynamic PIN sizes for PIN-based authentication. That means you don’t have to provide a number of PIN digits at runtime.
  • Supports custom authentication logic for PIN and Pattern. That means you can send the PIN or pattern to the server for authentication too.
  • It is highly customizable. So that you can match it with your application them. It provides you control over,
    • color and shape of each key. 👉 Guide
    • localized name of each key in pin keyboard. 👉 Guide
    • size of every single key.
    • color and shape of indicators to display a number of digits in the PIN. 👉 Guide
    • color and shape of pattern indicators.
    • tactile feedback for key press and authentication success/failure events.

Authentication using PIN/Fingerprint

Success Fail
Fingerprint Success Fingerprint Fail

Pattern based authentication

Here is the link of the demo application. 👉 Demo

Источник

Android pin code library

A customizable AndroidX pincode library for Android API 16+ written in kotlin. Includes animations as well as active and inactive state indicators.

You can include this library by adding the following code to your build.gradle (app) file:

Also make sure to include the following line in your project build.gradle file:

Add the PinCodeLayout in your xml file:

Implement the callback and set it to your pinCodeLayout:

An example project can be found in the example folder

Changing Pin Length

You can set your desired pin length in the xml via:

Changing Pin Icon

If your asset is not shown, make sure that the size does not extend the width or height of your pinCodeLayout.

You can choose, wheather you want your users to be able to see their input or not. If not, the unfilledPinIcon will be visible.

Changing Pin Layout Background

You can choose your own background. This can be a simple color or a drawable file

Changing colors of the bottom Bar indicator:

If you choose, not to show the bottom bar indicator, just set its color to transparent.

Changing Animation duration

By setting a Long value (milliseconds)

Changing Pin Type

You can choose one of the following types:

The keyboard will automatically show and accept only valid characters.

Источник

Android pin code library

A clean, minimalistic, easy-to-use and highly customizable pin lock custom view for Android.

This library allows you to implement a pin lock mechanism in your app easily and quickly. There are plenty of customization options available to change the look-and-feel of this view to match your app’s theme.

You can also use it as a dial pad to dial numbers. There are several other use cases of this library and is not restricted to only pin locking.

This library is available in jCenter which is the default Maven repository used in Android Studio.

We recommend you to check the sample app to get a complete understanding of the library. The step-by-step implementation guide is as follows.

Place the view in your XML layout file.

Reference the view in code and add a listener to it.

Implement the listener interface as follows,

And that’s it! Your PinLockView is ready to rock.

But the good thing is that the PinLockView comes with a whole lot of customization options which you can use to customize the view in any way you want.

PinLockView comes bundled with an addon view, IndicatorDots which can be optionally attached with the PinLockView to indicate pin changes visually to the user.

This view has been decoupled from the PinLockView so that you can optionally add it, if necessary. Suppose you are implementing a dial pad, then you will certainly not need this IndicatorView.

Add the view to you XML layout, generally placed above your PinLockView,

then find a reference to the view and attach it to the parent PinLockView,

You MUST attach it to the PinLockView, otherwise it will be simply ignored.

There are several theming options available through XML attributes which you can use to completely change the look-and-feel of this view to match the theme of your app.

This library is quite exhaustive and offers a lot of customization options. If you find a bug or would like to improve any aspect of it, feel free to contribute with pull requests.

About The Author

Android & Backend Developer. Blogger. Designer. Fitness Enthusiast.

Источник

PFLockScreen Library for Android

I created a PFLockScreen library — Lock screen library you can use in your application. It can be applications that encrypt some sensitive data like notes, pictures, etc or bank applications. For example, medical applications in Japan required additional security level as well.

If you would like to use it but have some issues or ideas fill free to create an issue on GitHub.

How the library works. We have typical UI to input pin code. That also allowed use fingerprint instead of a pin code.

Because AndroidKeystore doesn’t support custom pin for authorization I decided to have to parallel way to unlock app.

How library works inside

Using pin code.

If you don’t know how keysore and fingerprint API in Android works you can read about in my previous article

A user creates pin code. Using keystore and cipher object we encrypt the code. In a key generation, we set required authentication parameter to false. So we won’t need to use a fingerprint to unlock application (because in this case, we need to input pin code and use fingerprint at the same time).

Library encrypts pin code and returns an encrypted string.

For authorization user inputs pin code. The library compares inputted code with the encrypted one and if they match application is unlocked.

To use fingerprint we just will use FingerprintManager without a keystore. Because in our case password and fingerprint methods are separated we don’t actually need to encrypt/decrypt anything. So we just use Fingerprint API to confirm user’s identity. And if it’s confirmed the library returns unlocked state.

So the library can decrypt pin code without user’s fingerprint because we want to have two ways to unlock application

If you don’t need the UI part. You can use only encryption/decryption part of the library.

Источник

Читайте также:  Checkpoint android vpn client
Оцените статью