Recaptcha

public static class Recaptcha

Summary

Public fields

static @NonNull Recaptcha

Public methods

final @NonNull RecaptchaClient
fetchClient(@NonNull Application application, @NonNull String siteKey)

Returns a RecaptchaClient associated with the siteKey to access all reCAPTCHA APIs.

static final @NonNull Task<@NonNull RecaptchaTasksClient>
fetchTaskClient(@NonNull Application application, @NonNull String siteKey)

Returns a Task of RecaptchaTasksClient associated with the siteKey to access all reCAPTCHA APIs.

final @NonNull Result<@NonNull RecaptchaClient>
getClient(
    @NonNull Application application,
    @NonNull String siteKey,
    long timeout
)

This method is deprecated. Use fetchClient(Application, siteKey) instead.

static final @NonNull Task<@NonNull RecaptchaTasksClient>
getTasksClient(@NonNull Application application, @NonNull String siteKey)

This method is deprecated. Use fetchTaskClient(Application, siteKey) instead.

static final @NonNull Task<@NonNull RecaptchaTasksClient>
getTasksClient(
    @NonNull Application application,
    @NonNull String siteKey,
    long timeout
)

This method is deprecated. Use fetchTaskClient(Application, siteKey) instead

Public fields

INSTANCE

public static @NonNull Recaptcha INSTANCE

Public methods

fetchClient

public final @NonNull RecaptchaClient fetchClient(@NonNull Application application, @NonNull String siteKey)

Returns a RecaptchaClient associated with the siteKey to access all reCAPTCHA APIs.

The SDK supports one site key. Passing a different site key throws an exception.

Parameters
@NonNull Application application

The context of the application that is protected by reCAPTCHA.

@NonNull String siteKey

A reCAPTCHA key for Android registered for the caller app at https://cloud.google.com/recaptcha/docs/create-key

Returns
@NonNull RecaptchaClient

An instance of RecaptchaClient.

fetchTaskClient

public static final @NonNull Task<@NonNull RecaptchaTasksClientfetchTaskClient(@NonNull Application application, @NonNull String siteKey)

Returns a Task of RecaptchaTasksClient associated with the siteKey to access all reCAPTCHA APIs.

The SDK supports one site key. Passing a different site key throws an exception.

Parameters
@NonNull Application application

The context of the application that is protected by reCAPTCHA.

@NonNull String siteKey

A reCAPTCHA key for Android registered for the caller app at https://cloud.google.com/recaptcha/docs/create-key

getClient

public final @NonNull Result<@NonNull RecaptchaClientgetClient(
    @NonNull Application application,
    @NonNull String siteKey,
    long timeout
)

Returns a Result of RecaptchaClient associated with the siteKey to access all reCAPTCHA APIs.

The SDK supports one site key. Passing a different site key throws an exception.

At least a 10000 millisecond timeout is suggested to allow for slow networking, though in some cases longer timeouts may be necessary. The minimum allowable value is 5000 milliseconds.

Parameters
@NonNull Application application

The context of the application that is protected by reCAPTCHA.

@NonNull String siteKey

A reCAPTCHA key for Android registered for the caller app at https://cloud.google.com/recaptcha/docs/create-key

long timeout

Maximum amount of time to initialize the RecaptchaClient in milliseconds. Default value is 10 seconds.

Returns
@NonNull Result<@NonNull RecaptchaClient>

An instance of Result encapsulating a RecaptchaClient.

getTasksClient

public static final @NonNull Task<@NonNull RecaptchaTasksClientgetTasksClient(@NonNull Application application, @NonNull String siteKey)

Returns a Task of RecaptchaTasksClient associated with the siteKey to access all reCAPTCHA APIs.

The SDK supports one site key. Passing a different site key throws an exception.

This method will throw a timeout exception after 10 seconds.

Parameters
@NonNull Application application

The context of the application that is protected by reCAPTCHA.

@NonNull String siteKey

A reCAPTCHA key for Android registered for the caller app at https://cloud.google.com/recaptcha/docs/create-key

Returns
@NonNull Task<@NonNull RecaptchaTasksClient>

An instance of Task encapsulating a RecaptchaTasksClient.

getTasksClient

public static final @NonNull Task<@NonNull RecaptchaTasksClientgetTasksClient(
    @NonNull Application application,
    @NonNull String siteKey,
    long timeout
)

Returns a Task of RecaptchaTasksClient associated with the siteKey to access all reCAPTCHA APIs.

The SDK supports one site key. Passing a different site key throws an exception.

At least a 10000 millisecond timeout is suggested to allow for slow networking, though in some cases longer timeouts may be necessary. The minimum allowable value is 5000 milliseconds.

Parameters
@NonNull Application application

The context of the application that is protected by reCAPTCHA.

@NonNull String siteKey

A reCAPTCHA key for Android registered for the caller app at https://cloud.google.com/recaptcha/docs/create-key

long timeout

Maximum amount of time to initialize the RecaptchaClient in milliseconds. Default value is 10 seconds.

Returns
@NonNull Task<@NonNull RecaptchaTasksClient>

An instance of Task encapsulating a RecaptchaTasksClient.