> ## Documentation Index
> Fetch the complete documentation index at: https://docs.verifyyou.com/llms.txt
> Use this file to discover all available pages before exploring further.

# vycheck()

> Open a session in a full-screen native host and get the result through callbacks.

## Signature

<CodeGroup>
  ```kotlin Android theme={null}
  fun vycheck(
      context: Context,
      session: String,
      theme: String = "auto",
      onComplete: (VyResult) -> Unit,
      onClose: (() -> Unit)? = null,
      onError: ((String) -> Unit)? = null,
  ): VyCheckHandle
  ```

  ```swift iOS theme={null}
  static func vycheck(
      from presenter: UIViewController,
      session: String,
      theme: String = "auto",
      onComplete: @escaping (VyResult) -> Void,
      onClose: (() -> Void)? = nil,
      onError: ((String) -> Void)? = nil
  ) -> VyCheckHandle
  ```

  ```ts React Native theme={null}
  function vycheck(options: VyCheckOptions): VyCheckHandle;

  type VyCheckOptions = {
    session: string;
    theme?: "light" | "dark" | "auto";
    onComplete?: (result: VyResult) => void;
    onClose?: () => void;
    onError?: (message: string) => void;
  };
  ```
</CodeGroup>

Presents the hosted flow full screen in a native WebView. Inside it, the browser SDK opens the same session the way `vycheck({ session, mode: "iframe" })` does on the web, so the flow and its result match what you get there.

The screen adds a native close button, which stays visible until the run settles. Once the flow is up, that button, Back on Android and `handle.close()` close it the same way the flow's own close control does. If the run already has a verdict, closing delivers that result through `onComplete`, so the person never loses a finished check. Otherwise it calls `onClose`. If the flow does not answer within a short grace period, the screen closes anyway and calls `onClose`. Before the flow is up, they close the screen at once and call `onClose`.

On iOS, pass a `from` view controller that is on screen and is not being dismissed. If it is not, `onError` fires at once with `could not open the verification screen`, and the next `vycheck()` works normally. Each callback fires only after the screen has gone, so you can call `vycheck()` again from inside `onError` or `onClose`. If your app dismisses the screen itself, the run ends with `onClose`.

On React Native, `close()` affects only its own run. After that run has settled, `close()` does nothing, and it never closes a newer run.

## Options

<ParamField path="session" type="string" required>The `session_id` from `/v3/initialize`. The SDK opens that run: no key, no `init()`, ever passed here.</ParamField>
<ParamField path="theme" type="&#x22;light&#x22; | &#x22;dark&#x22; | &#x22;auto&#x22;" default="auto">`"light"` or `"dark"` forces that appearance, and the flow follows it. `"auto"` follows the device at the moment `vycheck()` is called.</ParamField>
<ParamField path="onComplete" type="(result: VyResult) => void" required>Required on Android and iOS. Optional on React Native, where the returned promise also resolves with the same result. Fires once, with a settled result. `token` is always present.</ParamField>
<ParamField path="onClose" type="() => void">The person dismissed the screen without finishing. This is not an error, and it is not a settled run. Do not call `vyget()` to look up its outcome: `vyget()` returns the last *completed* result, which can belong to an earlier run, not this dismissed one.</ParamField>
<ParamField path="onError" type="(message: string) => void">The run never reached a settled outcome at all. See [Errors](/v3/dev/spec/mobile-sdk/errors).</ParamField>

[`init()`](/v3/dev/spec/mobile-sdk/init) only sets `appBase`, once, for every call. It does not set `theme`, `onComplete`, `onClose`, or `onError`. Pass those to `vycheck()` itself, every time.

## Returns

<CodeGroup>
  ```kotlin Android theme={null}
  // A VyCheckHandle. Call close() to dismiss the screen early;
  // a no-op once the run has settled.
  interface VyCheckHandle {
      fun close()
  }
  ```

  ```swift iOS theme={null}
  // A VyCheckHandle. Call close() to dismiss the presented screen
  // early; a no-op once the run has settled.
  protocol VyCheckHandle {
      func close()
  }
  ```

  ```ts React Native theme={null}
  // A VyCheckHandle: a Promise<VyResult> with a close() method.
  // The promise resolves on completion or dismissal and rejects
  // on error, in addition to firing the callbacks above.
  interface VyCheckHandle extends Promise<VyResult> {
    close(): void;
  }
  ```
</CodeGroup>

## Errors

Never throws synchronously. See [Errors](/v3/dev/spec/mobile-sdk/errors) for what reaches `onError` and, on React Native, what the promise rejects with.

## Example

<CodeGroup>
  ```kotlin Android theme={null}
  VerifyYou.vycheck(
      context = this,
      session = sessionId,
      onComplete = { result ->
          // Send result.token to your server. Unlock only after it confirms.
          confirmOnServer(result.token) { verified -> if (verified) unlockAction() }
      },
      onClose = { /* they'll come back to it */ },
      onError = { message -> showRetry(message) },
  )
  ```

  ```swift iOS theme={null}
  VerifyYou.vycheck(
      from: self,
      session: sessionId,
      onComplete: { result in
          // Send result.token to your server. Unlock only after it confirms.
          confirmOnServer(result.token) { verified in
              if verified { self.unlockAction() }
          }
      },
      onClose: { /* they'll come back to it */ },
      onError: { message in self.showRetry(message) }
  )
  ```

  ```ts React Native theme={null}
  vycheck({
    session: sessionId,
    onComplete: async (result) => {
      // Send result.token to your server. Unlock only after it confirms.
      const verified = await confirmOnServer(result.token);
      if (verified) unlockAction();
    },
    onClose: () => {
      /* they'll come back to it */
    },
    onError: (message) => showRetry(message),
  });
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.