Using Flashlight in Camera?

Hello all together :slight_smile:

I'm new to AI2 and really impressed , how easy it could be , to create an app !

I was looking a few Tutorials , and decieded to copy one of them.It was a Tutorial
using the Camera.So far , so good , but i cannot use my flashlight :frowning:

I tried to turn it on , before opening the camera with the created "smile" button , but as soon the Camera opend , the flash light (or better : torch) turned OFF.

Is there a way to turn it on whilst the Camera App opens (and stays ON as long the Camera is opened ?) ??

Thank you very much

Hello there,

Probably not. When you use the Camera component you are technically inside your app but you're using the service of a different app - the default camera app of your phone. Therefore, you cannot control what the app can do.

However, what you can do is to build a custom camera that does not work with an external app. This will allow the user to preview and take the image through an arrangement as a "container", then you'll get the image. You will need a button to take the photo, and an arrangement to load the preview. This will require the help of an extension.

That is, unless if an extension developer can create an extension for this, or if there is an existing extension that I'm unaware of, but chances are, this is unlikely. Check out the Extensions Directory for a complete list of extensions.

Source: java - Keep flashlight ON while camera is opened - Stack Overflow

1 Like

This is exactly what I'm testing at the moment. Unfortunately, on my phone (Redmi Note 10S), the flashlight will refuse to activate when the rear camera is being used (the button is disabled, and the flashlight is immediately turned off when I turn it on with TaifunFlashlight). It does work when using the front camera, though:

Use this?

1 Like

That did it.

(ah yes, please note that this is my rear camera; for some reason, on my phone, the front and rear camera properties are mixed up)

1 Like

Where can i find the vertical arrangment1 ???

In the "Layout" tab of the palette. Since you seem to be extremely new, I don't think you know how to import extensions, either. I'll build an app for you and post the .aia file here. You can download it and import it into the App Inventor website.


5 posts were split to a new topic: Barcode scanner issue