Apple Inc. has been granted a US patent for a new facial recognition mechanism that enables users to unlock mobile phones by taking a selfie, according to a report by CBC News.

According to its patent application, Apple has been developing the iPhone feature since at least 2011.

“In an embodiment of the invention, an unlocked mobile device is configured to capture images, analyze the images to detect a user’s face, and automatically lock the device in response to determining that a user’s face does not appear in the images,” Apple writes in the patent application.

The document details how the technology works. The user positions the smartphone in front of his or her face, which causes the sensor to activate the processor to capture an image.

The image is then cross-checked with a previous image of the user’s face that was taken at the time of setting up the feature, and if the two images match, the phone automatically unlocks.

The patent application also states that the feature could be used to identify other authorized users, much like its Touch ID biometric fingerprint scanner that Apple first featured in the iPhone 5S.

Although most current Android phones currently offer a feature that enables users to automatically unlock the device by taking a selfie, “Google warns this is less secure than, say, a password, since someone who looks like you also could unlock the phone,” according to a report by Recode.

Apple’s technology aims to significantly improve on the facial recognition unlocking feature by ensuring that users do not have to press any buttons to activate their screens.

Instead, the technology is able to track the phone’s movements to recognize when the user is positioning it in front of his or her face.

Previously reported, Apple filed for a series of seven patent applications relating to biometrics, relating to credential verification processes that are used in association with Apple’s Touch ID, Apple Pay, unlocking redacted documents and more.