For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HUMAN DashboardHUMAN WebsiteRequest a Demo
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
    • Overview
  • Mobile SDK (for Android, iOS, and visionOS)
    • Android changelog
    • iOS, iPadOs, & visionOS changelog
    • Expo changelog
    • React Native Wrapper changelog
  • iOS SDK
    • What's New
    • How to test your app with the SDK
  • Android SDK
    • What's New
      • How to integrate the SDK in your application
      • How to verify the integration in your app with the SDK
      • Manual integration
      • Handle block responses from the server
      • How to retry requests that were blocked
      • Multiple AppIDs support
      • Hybrid App support
      • Enable support for Account Defender
      • Integration with React Native
      • Integration with Flutter
      • Integration with Ionic
      • Integration with gRPC
      • Migrating SDK from v2 to v3
    • How to test your app with the SDK
LogoLogo
Login
Login
HUMAN DashboardHUMAN WebsiteRequest a Demo
On this page
  • How to disable the request’s timeout
Android SDKv3

How to retry requests that were blocked

Was this page helpful?
Previous

Multiple AppIDs support

Next
Built with
What is the Automatic Interceptor?

The “Automatic Interceptor” is a feature that allows the SDK to intercept URL requests from your app. Enabling this will reduce the amount of code you will have to write as part of the SDK integration.

URL Requests that were blocked by HUMAN don’t reach your server. Therefore, after the user solves the challenge you may want to retry those requests. You can configure the behavior of the SDK when requests are blocked:

  1. Delay response until challenge is solved or cancelled - setting this in the policy will delay the error response to your request’s handler until the user solves or cancels the challenge. Then, the error you will receive contains the information regarding the challenge result (solved or cancelled).

    1policy.urlRequestInterceptionType = PXPolicyUrlRequestInterceptionType.INTERCEPT_WITH_DELAYED_RESPONSE
    1policy.setUrlRequestInterceptionType(PXPolicyUrlRequestInterceptionType.INTERCEPT_WITH_DELAYED_RESPONSE);
  2. Intercept and retry request - setting this in the policy will delay the error response to your request’s handler until the user solves or cancels the challenge. In addition, when the challenge is solved, the SDK will send the original request one more time. Your request’s handler should receive the response from your server without knowing that the request was blocked and sent again. You should note that when the challenge is cancelled or when the second request is also blocked, then the behavior will be the same as the “delay the response until the challenge is solved or cancelled” configuration.

1policy.urlRequestInterceptionType = PXPolicyUrlRequestInterceptionType.INTERCEPT_AND_RETRY_REQUEST
Disable the request's timeout

You should note that those features are built on top the OkHttp’s chain mechanism. Therefore, in order to delay the request’s response to your handler until the user interacts with the challenge, you must disable the request’s timeout in your HttpClient. Otherwise, your handler will receive a timeout error and you will not know that your request was blocked nor the challenge was solved/cancelled.

How to disable the request’s timeout

Ktor:

1private val httpClient: HttpClient = HttpClient(OkHttp) {
2 install(HttpTimeout) {
3 requestTimeoutMillis = HttpTimeout.INFINITE_TIMEOUT_MS
4 }
5}

OkHttp:

1var okHttpClient: OkHttpClient = OkHttpClient.Builder()
2 .callTimeout(0, TimeUnit.SECONDS)
3 .build()