Skip to main content

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 — openCameracamera, fetchAlbumPhotosphotos.

Methods

MethodReturn typePurpose
fetchAlbumPhotosPromise<ImageResponse[]>Fetch a list of photos from the device album.
openCameraPromise<ImageResponse>Open the camera and return the captured image.

Permission

Both functions are PermissionFunctionWithDialog callables and expose getPermission() / openPermissionDialog() directly on the function object.

MethodPermissionName
openCameracamera
fetchAlbumPhotosphotos
  • A denied status causes the call to fail — wrap in try/catch.
  • For notDetermined, prompt the user via openPermissionDialog() before calling.

See Guides — Permissions pattern for the full flow.

UX guidance

  • Cap image dimensions. Setting maxWidth to a reasonable value reduces network upload and memory use.
  • Use Base64 sparingly. base64: true avoids 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-example

External references