security – How can I use Android's Face Unlock within my own private application?-ThrowExceptions

Exception or error:

I want to use Face Unlock as a second factor for my app, since most of my users will not lock their phones with a password.

Are there Android APIs available to integrate Face Unlock in an Android app?

There are Face Detection APIs out there for photo recognition, but I couldn’t find APIs available that can be used in an offline scenario, specifically for an additional factor within an application.

If you need a real world example, assume that this is a password manager, or the phone will be loaned to a child… and the owner never locks the phone. Face unlock will secure the things they need private.

How to solve:

For those who don’t feel like reading: OpenCV can accomplish all of what you are looking for in terms of facial recognition. (Documentation here)

This is a difficult question to answer as few existing android applications make use of the facial recognition technology you ask for. However, you may want to check these sites out:

A good list of face detection software

A decent walkthrough for some of the main api’s available

Another higher quality tutorial…

Documentation for default android FaceDetector class

It might be useful to take a look at this sample which uses the OpenCV library

I understand the problem of not being able to accomplish this offline. To get around this you could always add a “backup” such as a normal passcode which only comes into effect after it is discovered that the user has no internet access. Another solution would be to simply require a stable internet/cellular connection for your app to function.

EDIT: Unfortunately,

Face unlock is closed-source google proprietary code, so we have no opportunity to modify it.
Source: http://forum.xda-developers.com/showthread.php?t=1367610

You are probably looking for the following information:

The most popular library for image manipulate and the like seems to be OpenCV which has a Java wrapper that can be found here

You would also need this to be running in the background, periodically checking user’s face without an indication that this is taking place so you should keep that in mind when choosing your library/approach

Source: A while ago, I implemented face recognition technology as a way for users to sign into one of my apps so I am just recounting what I remember in my search for an answer to this same question

Your scenario:

If you need a real world example, assume that this is a password manager, or the phone will be loaned to a child… and the owner never locks the phone. Face unlock will secure the things they need private.

As for accomplishing this, I would read up on android encryption if that is what you mean by “secure the things they need private.” Otherwise if you just want to create an “app lock” of sorts using face recognition instead of a passcode, this is much more simply and can be accomplished using intents/basic if-statements, etc. (I’m assuming you are accomplished with Java)

Please feel free to ask questions. Currently I am looking for my old source code where I did something similar to what you want but I doubt I still have it…

UPDATE: Check this out… and yes OpenCV can be used offline so I think this is what you guys are looking for

Leave a Reply

Your email address will not be published. Required fields are marked *