Recaptcha

object Recaptcha


Summary

Public functions

suspend Result<RecaptchaClient>
getClient(application: Application, siteKey: String, timeout: Long)

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

Task<RecaptchaTasksClient>
getTasksClient(application: Application, siteKey: String)

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

Task<RecaptchaTasksClient>
getTasksClient(application: Application, siteKey: String, timeout: Long)

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

Public functions

getClient

suspend fun getClient(
    application: Application,
    siteKey: String,
    timeout: Long = DEFAULT_TIMEOUT_INIT
): Result<RecaptchaClient>

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

The SDK currently supports one Site Key. Passing a different Site Key will throw 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
application: Application

The context of the application that is protected by reCAPTCHA.

siteKey: String

An Android site key registered for the caller app at https://cloud.google.com/recaptcha-enterprise/docs/create-key

timeout: Long = DEFAULT_TIMEOUT_INIT

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

Returns
Result<RecaptchaClient>

An instance of Result encapsulating a RecaptchaClient.

getTasksClient

fun getTasksClient(application: Application, siteKey: String): Task<RecaptchaTasksClient>

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

The SDK currently supports one Site Key. Passing a different Site Key will throw an exception.

This method will throw a timeout exception after 10 seconds.

Parameters
application: Application

The context of the application that is protected by reCAPTCHA.

siteKey: String

An Android site key registered for the caller app at https://cloud.google.com/recaptcha-enterprise/docs/create-key

Returns
Task<RecaptchaTasksClient>

An instance of Task encapsulating a RecaptchaTasksClient.

getTasksClient

fun getTasksClient(application: Application, siteKey: String, timeout: Long): Task<RecaptchaTasksClient>

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

The SDK currently supports one Site Key. Passing a different Site Key will throw 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
application: Application

The context of the application that is protected by reCAPTCHA.

siteKey: String

An Android site key registered for the caller app at https://cloud.google.com/recaptcha-enterprise/docs/create-key

timeout: Long

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

Returns
Task<RecaptchaTasksClient>

An instance of Task encapsulating a RecaptchaTasksClient.