How to use Fingerprint and PIN Code? - Perficient Blogs
Blog
  • Topics
  • Industries
  • Partners

Explore

Topics

Industries

Partners

How to use Fingerprint and PIN Code?

About Fingerprint

Nowadays, almost every smart phone has Fingerprint Identification, as you know, it’s safer and more convenient to use fingerprint to unlock your phone.

We usually use fingerprint to unlock screen, login App, and payment authentication. And Google Pixel use fingerprint swipe to access notifications. There is also an App called “Fingerprint Gestures” can allow you to use fingerprint sensor to customize more actions such as play song, toggle ringer mode, and screen scroll down. Indeed, we can see that fingerprint is a useful function and it has great possibility in the future.

Fingerprint

I use fingerprint to do the quick login in this App. You need to login first to turn on your “Touch Login”.

And then you can use it when you login next time. In fact, I think when I have “Remember” function, it’s not very important to use fingerprint especially I don’t have any privacy info in it. But this is just a demo, so never mind.

How to begin with code?

  1. add uses-permission in Manifest.xml
  2. check if device support fingerprint                       
  3. check if turn passcode on                                               
  4. check if enrolled fingerprint                                             
  5. start to authenticatePlease attention, don’t set CryptoObject “null”, because it can be used to prevent hostile attack from third-party.
  6. AuthenticationCallback

    We need to override these callbacks as following:

About PIN Code

I learnt two kinds of PIN Code of Android. One is used to protect SIM card, if you input wrong code three times, it will lock you SIM card and you need to use PUK Code to unlock it. And another is 4 digital number we used to unlock screen. What I need is a 4-digit number to do the quick login. And you need to create your PIN Code before you use it.

PIN Code

I used a third-party library,” LolliPin” (you can get it from GitHub) to do the PIN Code. It also contains fingerprint function, but I finish fingerprint before so I didn’t try it. Also, first, turn on “PIN” option in the settings. And after you enable your PIN, you can change PIN Code with new number.

I use 4 digital number as PIN Code, you can change length in code if you want.   

How to begin with code?

1.Prepare dependency

Download source code from GitHub, and then import it as a module. Add repository as following in your project’s gradle file, and don’t forget to compile it in your app’s gradle file.

2.enable PIN

3.change PIN

4.unlock PIN

That’s all, I’m a freshman of Android development, so if you find any problems, please kindly give me your advice.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up

Categories