cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
James_Elliott
Regular Visitor

using multiple camera Controls on one app

I've been building an application recently that requires the use of camera controls on multiple screens for some reason when I try to do this only the first screen I open actually allows me to use the camera. when I navigate to the next screen the camera seems to be disabled and says "Your Camera isn't set up properly, is currently in use or is improperly configured my the app maker" it almost seems like the camera control thinks that the camera control on the previous screen is still using it because when you turn the phone's screen off and on again it works (obviously I don't want my customers to have to turn their phone screen off and on again every time they want to take a picture) I've tried setting the Display Mode  property of the camera controls using variables so that they are always disabled when the screen they're on is not active however the error persists. does anyone have a fix or is this maybe something Power Apps just can't do?

1 ACCEPTED SOLUTION

Accepted Solutions
GarethPrisk
Resident Rockstar
Resident Rockstar

So Camera control's have a property called Camera, which is used to tell the app which camera (since many devices have multiple) to use. This defaults to 0, and is usually the rear camera on the phone.

 

Try having this property be dynamic for each control. Something like

If(
    App.ActiveScreen = Screen1,
    0,
    -1
)

This may trick the other controls into unlocking the device's camera. It may also continuously prompt to allow use of camera - not sure.

 

Could you consolidate the Camera functionality into a single screen and route to that screen from the others? If not, I recommend trying the AddPicture control over the Camera control. It has a number of advantages, and behaves well on mobile devices. This may remedy this particular issue, as well.

View solution in original post

5 REPLIES 5
GarethPrisk
Resident Rockstar
Resident Rockstar

So Camera control's have a property called Camera, which is used to tell the app which camera (since many devices have multiple) to use. This defaults to 0, and is usually the rear camera on the phone.

 

Try having this property be dynamic for each control. Something like

If(
    App.ActiveScreen = Screen1,
    0,
    -1
)

This may trick the other controls into unlocking the device's camera. It may also continuously prompt to allow use of camera - not sure.

 

Could you consolidate the Camera functionality into a single screen and route to that screen from the others? If not, I recommend trying the AddPicture control over the Camera control. It has a number of advantages, and behaves well on mobile devices. This may remedy this particular issue, as well.

So I tried your first idea this Morning and it works perfectly thanks for the advice @GarethPrisk 

 

JvandeKraats
Frequent Visitor

When you are desperate for a solution and then you come across heroes like @GarethPrisk, with a quick and practical solution. Awesome!!

Thank you so much, you saved my day and the update of an app at a big client. Kudos!!!

This dont work for me, I'm desperate, the camera i need is "2", I worte this code on the Camera property of the Camera control. But keeps doing the same, first time you enter the screen where you have to use the camera it works perfect but once you go any other screen and come back, it doesnt work again...

JvandeKraats
Frequent Visitor

@vierglezmtiin Sorry to hear it's not working.
I may have a solution to your problem, it has one drawback; but does work.
I used a global variable and put this variable in the 'control' function of the camera.
You can now use the variable to choose a certain camera or to turn it off by setting the variable to 0.
When I want to use the camera control I set the variable to 2 and when I want to turn off the camera, I set the variable to 0.

For example:
Set(ControlCamera, 2) - Camera 2 is used
Set(ContralCamera, 0) - the camera is off.

One drawbeck, power apps sets the control function of a camera by default to 0 when you import an app by zipfile. So when you import an app you have to manually enter this variable in the camera control and only then publish the app

Is this fixing your problem? Please give this a tumbs up!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,819)