Skip to Content
PlatformsCapacitor

Capacitor Plugin

Using our Capacitor plugin makes it easy to integrate Shen.AI into hybrid apps targeting Android and iOS.

The best way to get started is to download and build the example app - available here on GitHub .

Installing the plugin

See the Customer Portal for SDK downloads.

Add the plugin as a dependency in package.json:

package.json
"dependencies": { ... "capacitor-shenai-sdk": "file:./capacitor-shenai-sdk" }

WebView overlay (Android)

On Android, the SDK preview is rendered in a native view below the WebView, and the WebView background is made transparent so the camera feed stays visible. Touch events on the WebView are forwarded to the SDK view automatically.

You can reposition the preview and control whether it overlays the WebView with setViewRect and setOverlaysWebview (Android only). See configuration for usage.

Custom frame input

Capacitor exposes CameraMode.CUSTOM_FRAMES, so you can configure the SDK not to start a camera:

import { ShenaiSdkCapacitor, CameraMode } from "capacitor-shenai-sdk"; await ShenaiSdkCapacitor.initialize({ apiKey: API_KEY, userId: USER_ID, settings: { cameraMode: CameraMode.CUSTOM_FRAMES, }, });

CustomFrames in Capacitor only configures the session. The Capacitor binding does not provide a raw frame-submission API, so frames must be submitted from native Android/iOS code through the native SDK APIs shown on the Android and iOS pages.

Further steps

Please see permissions, initialization, configuration and video measurement for further steps.