harmony 鸿蒙Obtaining Enrolled Credential Status
Obtaining Enrolled Credential Status
Use getEnrolledState() to obtain the change in the credentials (face, fingerprint, and password) enrolled by a user.
Available APIs
For details about the parameters, return values, and error codes, see getEnrolledState.
API | Description |
---|---|
getEnrolledState(authType : UserAuthType): EnrolledState | Obtains the status of the enrolled credentials based on the specified authentication type. |
How to Develop
Check that the application has the ohos.permission.ACCESS_BIOMETRIC permission. For details about how to request permissions, see Requesting Permissions.
Specify the authentication type (UserAuthType) and call getEnrolledState to obtain the status of the credentials enrolled by the user.
Example: Obtain information about the credentials enrolled for facial authentication.
import { BusinessError } from '@kit.BasicServicesKit';
import { userAuth } from '@kit.UserAuthenticationKit';
try {
let enrolledState = userAuth.getEnrolledState(userAuth.UserAuthType.FACE);
console.info(`get current enrolled state success, enrolledState: ${JSON.stringify(enrolledState)}`);
} catch (error) {
const err: BusinessError = error as BusinessError;
console.error(`get current enrolled state failed, Code is ${err?.code}, message is ${err?.message}`);
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙User Authentication Kit (User Authentication Service)
harmony 鸿蒙Applying Custom Authentication
harmony 鸿蒙Canceling User Authentication
harmony 鸿蒙Obtaining Supported Authentication Capabilities
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦