Google is committed to advancing racial equity for Black communities. See how.

PasswordComplexityServiceClient

public class PasswordComplexityServiceClient extends GoogleApi<Api.ApiOptions.NoOptions>

A GoogleApi client for password complexity check API.

Constant Summary

String EXTRA_PASSWORD_COMPLEXITY An integer indicating the complexity level of the new password an app would like the user to set when launching the action INTENT_ACTION_SET_NEW_PASSWORD.
String INTENT_ACTION_SET_NEW_PASSWORD Intent action which launches system set new password activity and allows the calling app to specify the complexity level wanted.

Public Method Summary

static PasswordComplexityServiceClient
Task<Integer>
getPasswordComplexity()
Returns PasswordComplexityCheckResult indicating how complex the screen lock is, or the reason why the complexity cannot be determined.

Inherited Method Summary

Constants

public static final String EXTRA_PASSWORD_COMPLEXITY

An integer indicating the complexity level of the new password an app would like the user to set when launching the action INTENT_ACTION_SET_NEW_PASSWORD.

Must be one of

If an invalid value is used, it will be treated as PasswordComplexityCheckResult.PASSWORD_COMPLEXITY_NONE.

Requires normal permission "com.google.android.gms.permission.REQUEST_SCREEN_LOCK_COMPLEXITY".

Constant Value: "com.google.android.gms.extra.PASSWORD_COMPLEXITY"

public static final String INTENT_ACTION_SET_NEW_PASSWORD

Intent action which launches system set new password activity and allows the calling app to specify the complexity level wanted.

Apps can use getPasswordComplexity() to check the current screen lock complexity, and use this activity with extra EXTRA_PASSWORD_COMPLEXITY to suggest to users how complex the app wants the new screen lock to be. Note that both getPasswordComplexity() and this intent action (with or without extra EXTRA_PASSWORD_COMPLEXITY) require the calling app to have the normal permission "com.google.android.gms.permission.REQUEST_SCREEN_LOCK_COMPLEXITY".

This action launches the same activity as DevicePolicyManager.ACTION_SET_NEW_PASSWORD but the system provided action does not accept EXTRA_PASSWORD_COMPLEXITY.

Constant Value: "com.google.android.gms.action.SET_NEW_PASSWORD"

Public Methods

public static PasswordComplexityServiceClient getClient (Context context)

public Task<Integer> getPasswordComplexity ()

Returns PasswordComplexityCheckResult indicating how complex the screen lock is, or the reason why the complexity cannot be determined.

Returns ApiException instead if the API is not available on the device.