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

# Embed in Mobile App

Embed Connect in your mobile app using web views. Connect will broadcast an event with the message `connect_exit` when you should dismiss the webview. See below for specific implementation details.

## iOS

<Tabs>
  <Tab title="WKWebView">
    ```swift WKWebView theme={null}
    self.webView.configuration.preferences.javaScriptEnabled = true
    self.webView.configuration
        .userContentController.add(self, name: "connectMessageHandler")
    self.webView.load( /*connect link request*/ )
    ```
  </Tab>

  <Tab title="SFSafariViewController">
    Using your app's Custom URL Scheme, generate a callback URL that your app will use to dismiss the *Connect* `SFSafariViewController`.
  </Tab>
</Tabs>

## Android

<Tabs>
  <Tab title="WebView">
    ```java WebView theme={null}
    class JsObject {
    @JavascriptInterface
        public boolean postMessage(String message, String transferList) {
            if (message.equals("connect_exit")) {
                //dismiss the webview here
            }
            return true;
        }
    }

    // And when initializing the webview 
    webView.addJavascriptInterface(new JsObject(), "connectMessageHandler");
    ```

    Connect will post an event using the `connectMessageHandler` object you created, with a message of `connect_exit`. When your application receives that message, you should dismiss the *Connect* webview.
  </Tab>
</Tabs>

## React Native

<Tabs>
  <Tab title="react-native-webview">
    ```jsx theme={null}
    const onMessage = (event) => {
        if (event?.nativeEvent?.data === 'connect_exit') {
            //dismiss web view here
        }
    }

    <WebView ... onMessage={onMessage} />
    ```

    Connect will post an event using the `onMessage` handler you created, with a message of `connect_exit`. When your application receives that message, you should dismiss the *Connect* webview.
  </Tab>
</Tabs>

## Need Addional Support?

If your application needs a different callback scheme, just [let us know](mailto:developer@manifestfinancial.com).
