Android 6.0 saw the introduction of fingerprint authentication, a new security feature that allows users to confirm their identify with a single touch. While this new security feature is most commonly used to secure the user’s lockscreen, fingerprint authentication can also be a useful addition to your apps, allowing you to secure sensitive features such as in-app payments, or replace password-and-username screens with a much more convenient single-touch sign in.
In this article, I’m going to show you exactly how to implement fingerprint authentication in your own apps, by walking you through the process of creating a sample app that registers when the user places their fingertip against their device’s touch sensor, processes their input, and then displays a range of toasts depending on whether the fingerprint authentication has succeeded or failed. We’ll also be looking at how to test fingerprint authentication on Android Virtual Devices (AVDs) that don’t feature a physical touch sensor, as well as some best practices to make sure you’re getting the most out of this new feature. How to add fingerprint authentication to your Android app. You eager to try out fingerprint authentication in your own apps, then there’s a few best practices that can help you get the most. Oct 1, 2018 - Go to Settings > Touch ID & Passcode to manage these settings: Turn Touch ID on or off for Passcode, iTunes & App Store, or Apple Pay. Enroll up to five fingerprints. Tap a fingerprint to rename it. Swipe to delete a fingerprint. Identify a fingerprint in the list by touching the Home button. Learn how to set up and use Touch ID, a fingerprint identity sensor that makes it easy for you to get into your device. Use Touch ID on iPhone and iPad. Learn how to set up and use Touch ID, a fingerprint identity sensor that makes it easy for you to get into your device. Set up Touch ID. Use Touch ID. App Store, and Apple Books. Now, to lock apps with your fingerprint, you will need to enable Touch ID within the app you want to use. Open the app and navigate to Settings. Tap Passcode & Touch ID, or something similar depending on the app. Enable the Passcode setting and choose a passcode. Then toggle on Touch ID. You may have to re-enter your passcode. Now you can use. That’s probably not something you’ve ever encountered when asked to authenticate yourself using your fingerprint or face. And Google Play before you download it. If an app offers some. How to Lock Apps Using Fingerprint Scanner on Redmi Note 5 and Redmi Note 5 Pro. Step 1: Make sure to register your fingerprint and set up fingerprint lock on the Redmi Note 5 and Redmi Note 5 first. Then, head over to Security app, which can be found in the Tools folder on the home screen and select App lock. Why should I care about fingerprint authentication?Adding fingerprint authentication to your project is a multi-step process, so to help you decide whether it’s worth the initial time and effort, let’s look at some of the ways in which fingerprint authentication can improve the user experience:
Creating our fingerprint authentication projectIf you’ve weighed up everything that fingerprint authentication has to offer and have decided that it’s something you want to start using in your apps, then there’s a few steps you’ll need to complete. The most effective way of familiarizing yourself with these steps is to see them in action, so let’s create a sample app that’s capable of performing fingerprint authentication. Open Android Studio and create a new project. You can use the settings of your choice, but for the sake of simplicity you may want to set your project’s minimum SDK to 23 or higher. This ensures your app is never installed on a device running a version of Android that pre-dates fingerprint authentication. If you do allow users to install your app on pre-Marshmallow versions of Android, then your app will need to verify what version of Android it’s on, and then disable its fingerprint-related features where appropriate. Once you’ve created your project, we’ll need to make some adjustments to the Manifest and build the app’s user interface. Updating the ManifestOur app is going to require access to the device’s touch sensor in order to receive fingertip touch events. However, the Android operating system runs on a wide range of devices, and not every one of these devices includes a touch sensor. If fingerprint authentication is essential to your app providing a good user experience, then you should consider preventing your app from being installed on devices that don’t include this piece of hardware. You can declare that your app requires a touch sensor in order to function, by adding the following to your Manifest: When you mark a feature as android:required=”true,” the Google Play store will only allow users to install your app on devices that fulfil all of these hardware requirements. If your app can function without a fingerprint sensor then you should mark the touch sensor as preferred, but not required: Google Play will then permit users to download your app even if their device doesn’t have a fingerprint sensor. If you do opt for this approach, then your app will need to check for the presence of a touch sensor at runtime and then disable its fingerprint authentication features, where appropriate. While it may seem strange to declare a feature in your Manifest just so you can state that your app doesn’t actually need it, declaring every feature your app uses will help to ensure you don’t get caught out by implicit hardware requests. Certain permissions make implicit hardware requests, for example if you add the android.hardware.camera permission to your Manifest, then this implies that your app requires a camera in order to run. Google Play will then prevent your app from being installed on devices that don’t include camera hardware – unless you explicitly state that your app prefers this hardware to be available, but can function without it. To ensure Google Play doesn’t prevent users from downloading your app based on incorrect assumptions about your app’s requirements, try to get into the habit of declaring every feature that your app uses, and then mark them as android:required=”false” or android:required=”true.” The final change you’ll need to make to your project’s Manifest, is requesting permission to access the fingerprint sensor: Creating your user interfaceNext, we’ll need to build our user interface. Open your strings.xml file and add the following: Google provides a standard fingerprint icon that they recommend you display whenever your app requests fingerprint authentication from the user, so download this icon and add it to your project’s ‘Drawable’ folder. Now we have all our resources, let’s create our UI: Your user interface should look something like this: Creating your MainActivity.java fileNow it’s time to implement the fingerprint authentication part of our app. We’re going to be performing the bulk of the fingerprint authentication in our MainActivity.java file, so I’m going to look at this file in two parts. In the first half, we’re going to focus on checking that the device has the hardware, software and settings required to support fingerprint authentication, and in the second half we’re going to create the key, cipher and CryptoObject that we’ll use to perform the actual authentication. Specifically, in this first part of our MainActivity file we’re going to check that:
If any of the above requirements aren’t met, then your app should gracefully disable all features that rely on fingerprint authentication and explain why the user cannot access these features. You may also want to provide the user with an alternative method of confirming their identity, for example by giving them the option to create a password and username. In addition to completing these tasks, I’m also going to create an instance of FingerprintManager. This is a class that we’ll be using throughout the fingerprint authentication process, which is why it makes sense to establish it early in our MainActivity file. If all of these conditions are met, then your app is ready to start the fingerprint authentication process. In the second half of our MainActivity file, we’re going to complete the following:
The second half of our MainActivity file looks like this: Creating the fingerprint helper classOur final task is creating the helper class that we referenced in our MainActivity file. This class will be responsible for triggering the authentication method and processing the various callback events that can occur depending on whether the authentication has succeeded, failed, or an error has occurred. Create a new FingerprintHandler.java class and add the following: Testing your projectWhenever you’re working on an Android app, you should test that app across a wide range of Android Virtual Devices (AVDs) plus at least one physical Android smartphone or tablet. Assuming that you have access to a physical smartphone or tablet that’s running Android 6.0 or higher and features a fingerprint sensor, testing our sample app on a physical Android device should be fairly straightforward. First, make sure your Android smartphone or tablet is configured to support fingerprint authentication by securing your lockscreen with a PIN, password or pattern and then registering at least one fingerprint on your device. Typically, you register a fingerprint by opening your device’s ‘Settings’ app, selecting ‘Security > Fingerprint,’ and then following the onscreen instructions. How To Use Your Fingerprint To Download Apps For PcInstall and launch the sample app on your device, then put it to the test by placing your fingertip against your device’s fingerprint sensor. The app will then display various toasts depending on whether the authentication succeeds, fails, or an error has occurred. Spend some time making sure the app is reacting to each event correctly. When it comes to testing Android’s fingerprint authentication on an AVD, there’s an immediate problem: an emulated Android device doesn’t have any physical hardware. However, AVDs are a crucial tool for testing Android apps across a wide range of different hardware and software, so you’ll need to find a way to test fingerprint authentication on an AVD. The solution, is to use Android Debug Bridge (ADB) commands to fake a touch event. Open your Mac’s Terminal (or Command Prompt if you’re a Windows user) then change directory (cd) so it’s pointing at your Android SDK download; specifically, the Android/sdk/platform-tools folder. My command looks like this: Once your Terminal pointing in the right direction, create and launch the AVD you want to use, then install your app on this AVD. You’ll need to “register” a fingerprint with this device, so navigate to your AVD’s ‘Settings > Security > Fingerprint’ screen. When the AVD prompts you to place your finger against the sensor, fake a fingerprint touch event by typing the following command into your Terminal window: For example, my command looks like this: Then press the ‘Enter’ key on your keyboard. The AVD should confirm that you’ve successfully registered a new fingerprint: How To Use Your Fingerprint To Download Apps For Windows 7Launch our sample app and re-enter this command into your Terminal, and the AVD will act as though you’ve placed a registered fingerprint against the device’s non-existent fingerprint sensor. Best PracticesIf this sample app has got you eager to try out fingerprint authentication in your own apps, then there’s a few best practices that can help you get the most out of this feature:
Wrapping UpIn this article we looked at the steps you’ll typically need to complete in order to add fingerprint authentication functionality to your apps – if you want to try this project for yourself, then you’ll find the complete code on GitHub. There’s a wide range of ways that you can use this kind of single-touch identification to improve the user experience – from adding an extra layer of security to your in-app payments, to providing an easy way to lock and unlock sensitive areas of your app, or even removing the need for users to their and password every time they want to use your app. If you have any plans to use fingerprint authentication in your projects, then let us know in the comments! Please enable JavaScript to view the comments powered by Disqus.How To Use Your Fingerprint To Download Apps FreeIf you have a specific app you want to lock so that others can't access it, the most secure way of doing so is with biometrics. While there are options to lock apps with either a PIN or pattern, these can easily be figured out with a simple glance over your shoulder. It's much more difficult for someone to crack your fingerprint ID, unless they chop off your finger, of course. How To Use Your Fingerprint To Download Apps FreeUnfortunately, not every Android device comes with a fingerprint scanner, but what they do all come with is a camera. So today, I'll be showing you how to fingerprint-lock apps using your camera as the fingerprint scanner—no matter what Android phone or tablet you have. How To Use Your Fingerprint To Download Apps For Iphone
0 Comments
Leave a Reply. |