camera
Functions for capturing photos with the device camera or reading the photo album. Both require a permission, but they map to different PermissionName values — openCamera → camera, fetchAlbumPhotos → photos.
Methods
| Method | Return type | Purpose |
|---|---|---|
fetchAlbumPhotos | Promise<ImageResponse[]> | Fetch a list of photos from the device album. |
openCamera | Promise<ImageResponse> | Open the camera and return the captured image. |
Permission
Both functions are PermissionFunctionWithDialog callables and expose getPermission() / openPermissionDialog() directly on the function object.
| Method | PermissionName |
|---|---|
openCamera | camera |
fetchAlbumPhotos | photos |
- A
deniedstatus causes the call to fail — wrap intry/catch. - For
notDetermined, prompt the user viaopenPermissionDialog()before calling.
See Guides — Permissions pattern for the full flow.
UX guidance
- Cap image dimensions. Setting
maxWidthto a reasonable value reduces network upload and memory use. - Use Base64 sparingly.
base64: trueavoids file-system reads but is expensive for large images. - Prompt for permission on user action. Trigger the dialog after a "Pick a photo" tap, not on page load.
Try it live
Both methods are available on the Camera page in sdk-example.
Open in sdk-exampleExternal references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.