filePicker so the attach button uses native pickers instead. Picked files are delivered to the hosted widget over the SDK bridge, mirrored to cache when configured, and re-delivered until the widget acknowledges them.
Choose a picker path
Use one of these approaches:- Install
@sagepilot-ai/react-native-camera-addonfor Sagepilot’s Android in-app CameraX picker. - Use
createSagepilotFilePicker(...)from the base SDK when your app already provides camera, gallery, or document picker modules.
Android CameraX addon
Install the addon when your Android app wants Sagepilot’s in-app CameraX picker:
By default, the addon uses CameraX
1.5.3, ExifInterface 1.4.2, and AndroidX Activity 1.10.1. Override them from the root Gradle project with sagepilotCameraXVersion, sagepilotExifInterfaceVersion, and sagepilotActivityVersion when your app needs pinned AndroidX versions.
Run a fresh native Android build after installing the addon. A Metro reload is not enough for React Native autolinking to register NativeModules.SagepilotInAppCamera.
For Expo apps, use a native/dev-client build:
configure():
createSagepilotCameraXFilePicker() returns undefined outside Android, so shared app setup can call it safely. On iOS, no additional setup is required for the CameraX addon unless your app provides its own native iOS picker.
With this adapter enabled on Android, the hosted widget routes each attachment action to its matching native source:
When the addon advertises these sources, gallery and file actions do not use a generic WebView file chooser.
Host-provided picker modules
Use this path when your app already owns picker dependencies or needs a custom iOS picker. Install only the modules your app needs:createSagepilotFilePicker(...):
createSagepilotFilePicker(...).
Durable recovery
For the strongest recovery path, pass bothcacheStorage and fileStore.
cacheStorage stores the picked-file batch manifest. fileStore stores picked-file bytes in app-private storage so a captured photo or document can survive an app-process restart within the hosted widget’s upload limits.
Upload limits
The hosted widget enforces the final attachment limits for both WebView and native picker flows.
The native picker also applies earlier safety guards before files are read into memory.
These picker guards reduce out-of-memory risk. They do not raise the hosted widget’s final upload limits.
Platform notes
- The CameraX addon is Android-only. It owns CameraX dependencies, the native module, camera activity, overlay, and image processing.
- Camera and gallery images are downscaled natively to keep memory and upload sizes low.
- Picker failures are surfaced with typed error codes such as
permission_denied,camera_unavailable,encode_failed,file_too_large, andread_failed. - Android apps that use the CameraX addon must grant
CAMERAat runtime before opening the Sagepilot picker. If permission is missing or denied, ask users to grant it from your app flow or Android settings before presenting the camera action again. - No additional iOS setup is required for the CameraX addon. Add iOS permission strings only if your app separately provides its own native iOS picker.
- Apps that skip
filePickerkeep the WebView file input. The SDK can recover from WebView renderer crashes, but a photo captured at crash time cannot be restored in that mode.