Camera - Displays the camera to take photos and record videos in an Arrangement.

Camera
Displays the camera to take photos and record videos in an Arrangement.

.......... Screenshots ..........

AspectRatio: 1:1

AspectRatio: 3:4

AspectRatio: 9:16

AspectRatio: Full


For a more standard camera size you can leave the Arrangement height at 70%.

  • I'm creating a separate extension to give it the AspectRatio of 1:1, 3:4, 9:16 automatically.

When initializing you must grant this permissions:


HasCameraPermission

Checks if camera permission is granted.

component_method (10)


StartCamera

Starts the camera and displays it in the Arrangement.


StopCamera

Stops the camera and releases resources.

component_method (12)


SwitchCamera

Switch between front and rear cameras.

component_method (11)


TakePicture

Take a photo and save automatically.

component_method (10)


SetZoomLevel

Adjust the zoom level (1-10)

You can also zoom by pinching without using this function.


GetZoomLevel

Gets the current zoom level

component_method (9)


GetMaxZoomLevel

Gets the maximum zoom available

component_method (8)


FocusOnPoint

Focus on a specific point on the screen (x, y between 0-1)


CaptureAndGetPath

Captures a photo and returns the file path

component_method (7)


StartRecording

Start video recording

component_method (6)


StopRecording

Stops video recording

component_method (5)


IsCameraActive

Check if the camera is active.

component_method (4)


CameraResolution

Gets the current camera resolution.

component_method (1)


HasFlash

Check if the device has flash.

component_method (2)


AvailableCamerasCount

Gets the number of available cameras.

component_method (3)


IsRecording

Check if video is currently being recorded.

component_method


CameraId

Camera ID to use (0: rear, 1: front)

blocks (3)

component_set_get (3)


FlashEnabled

Turn the camera flash on or off

blocks (4)

component_set_get (4)


AutoFocusEnabled

Turns autofocus on or off

blocks (5)

component_set_get (5)


TouchToFocusEnabled

Turn touch focus on or off

blocks (6)

component_set_get (12)

You can focus on a specific point by touching the screen.


JpegQuality

JPEG quality for photos (0-100)

blocks (8)

component_set_get (6)


SaveDirectory

Directory where to save the photos

blocks (7)

component_set_get (7)

Currently only saving in Pictures is available.


CaptureSoundEnabled

Turn the sound on or off when taking a photo

blocks (14)

component_set_get (8)


VideoBitrate

Video bitrate (bits per second)

blocks (10)

component_set_get (10)


VideoFrameRate

Frame rate per second for video

blocks (9)

component_set_get (9)


FocusFrameColor

Focus frame color

blocks

component_set_get


FocusFrameDisappearanceTime

Frame disappearance time in milliseconds

blocks (1)

component_set_get (1)


FocusFrameSize

Focus frame size

blocks (2)

component_set_get (2)


PictureError

Triggered when an error occurs while taking a photo


CameraReady

It fires when the camera is ready


CameraSwitched

It fires when the camera is changed


FocusedOnPoint

It fires when you focus on a touch point


RecordingStarted

Triggered when video recording starts


RecordingStopped

Triggered when video recording is stopped


RecordingError

Triggered when an error occurs during video recording


ZoomChanged

Triggered when the zoom level changes, either by gestures or programmatically


ZoomEnded

Fires when the user finishes zooming, either by releasing the screen or ending the pinch gesture


PictureTaken

It is triggered when a photo has been taken successfully. Returns both the file path and content URI.


v1.1 March 07, 2026.

  • A function was added to check if camera permission was granted.

  • An additional parameter was added to the PictureTaken event to receive the content URI of the captured photo.

  • Now you can also view the received image by placing it in the image component using imagePath when using Companion.

Camera.aia (83.9 KB)

joejsanz.joedevcamera.aix (33.7 KB)


JDK: 11
Minimum API Level: 21
Updated On: 2026-03-07T08:00:00Z

Built using: FAST-CLI v5.7.0-premium


Thanks.

9 Likes

When i use the when JoeDevCamera1.PictureTaken, can i then use the imagePath to show the image in a Preview (image - imgPreview.Picture
)

Did you try it ?

Yes but nothing happens.
I tried to make the photobooth with this instead, but i cant get it to show in imgPreview.Picture.
Wedding.aia (36.1 KB)

What does the imagePath looks like? (use Do It)

There is a popup box with unbound variables

Enter values for:
ImagePath=

Do it Cancel

But the address is /storage/emulated/0/Pictures/WeddingBooth/IMG_20260301_180954.jpg.

That shows the lblCountDown.Text. And the file is in that folder.

But it will not shows in imgPreview.

Try adding file:// to the beginning of the filepath

will you have it to be file://Pictures/WeddingBooth

Then it shows nothing in the lblCountDown either.

Ahh now i tried
set imgPreview.Picture to
join
"file://"
get ImagePath, and i think it maybe shows now.

Well, it either does or it doesn't ?

@Joejsanz
@TIMAI2
But there is one thing i dont can get to work.
Before the camera take a picture, it is in portrait, but the imgPreview.Picture and the saved picture is in landscape. How to get it in portrait?

Adding file:// as Tim suggested does display the image, and I took the picture and it came out fine.
I don't know why your image is rotated.

Perhaps there's a setting you used that I'm unaware of, or could it be the type of device?

I tested it on a:

  • Xiaomi Redmi Note 13 Pro
  • Android 15

if Image.Width > Image.Height than set Image.RotationAngle to 90

I see similar issues to Kent

App setup with a portrait vertical arrangement h300xw200, so expectation is an image as seen when camera is active:

On take picture, this is what I get:

1 Like

This is an old issue with some device manufacturers like Samsung, for those just follow @Anke 's advice

See also in Android: Image captured by camera is 90 degree rotated and cannot be properly displayed on a canvas · Issue #3330 · mit-cml/appinventor-sources · GitHub

Taifun

2 Likes

Yep thats turns the imgPreview, but the saved picture is still in landscape.

What device are you using?

  • (Brand and Android version).

OnePlus 10 Pro 5G
Android: 16

Google Pixel 8a, Android 16

I made some changes, but I have no way to test if it still rotates on other devices.

And in the PictureTaken event, it's no longer necessary to add file:// to the path.

Now it will also return the URI (ImagePath can be used in Companion, but the URI cannot).

Camera1.aia (36.2 KB)