目录

FaceManager

Class Info

public abstract class FaceManager

人脸识别类,用于执行人脸识别。

Public Method Summary

Qualifier and Type

Method Name and Description

void

authenticate()

发起一次人脸识别认证,认证结果通过callback返回。

FaceRecognitionCapability

getFaceRecognitionCapability()

获取当前设备的人脸识别能力。

EMUI 11.0.1及以上版本支持。

boolean

hasEnrolledTemplates()

获取当前设备是否已录入人脸。

EMUI 11.0.1及以上版本建议使用getFaceRecognitionCapability。

boolean

isHardwareDetected()

获取当前设备是否支持人脸识别。

EMUI 11.0.1及以上版本建议使用getFaceRecognitionCapability。

Public Methods

[h2]authenticate

Method

public void authenticate(CryptoObject crypto, CancellationSignal cancel, int flags, AuthenticationCallback callback, Handler handler)

发起一次人脸识别认证,认证结果通过callback返回。

Parameters

Name

Description

crypto

密码操作对象,参数可以为null,参见CryptoObject。

cancel

取消认证信号,参数可以为null。

flags

认证标记。

callback

认证结果回调, 参见AuthenticationCallback。

handler

认证相关回调处理的Handler,参数可以为null。

[h2]getFaceRecognitionCapability

Method

public FaceRecognitionCapability getFaceRecognitionCapability()

获取当前设备的人脸识别能力。

EMUI 11.0.1及以上版本支持。

Returns

Type

Description

FaceRecognitionCapability

设备人脸识别能力,参见FaceRecognitionCapability。

[h2]hasEnrolledTemplates

Method

public boolean hasEnrolledTemplates()

获取当前设备是否已录入人脸。

EMUI 11.0.1及以上版本建议使用getFaceRecognitionCapability。

Returns

Type

Description

boolean

表明当前设备是否已录入人脸,如果已录入人脸为true,如果未录入人脸为false。

[h2]isHardwareDetected

Method

public boolean isHardwareDetected()

获取当前设备是否支持人脸识别。

EMUI 11.0.1及以上版本建议使用getFaceRecognitionCapability。

Returns

Type

Description

boolean

表明当前设备是否支持人脸识别,如果支持人脸识别为true,如果不支持人脸识别为false。