cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
omarsalgado
Level: Powered On

Disable phone's camera

Hello everyone,

I would like to know if it is possible to disable phone's camera (or cameras in case there is more than one) through a control, perhaps by scanning a QRcode or so.

Thanks

Omar salgado

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Disable phone's camera

You can disable the camera as it's being used in your app within PowerApps. You cannot disable the camera for all apps in the phone.

 

To disable the camera in your app, you can set the DisplayMode property of the camera control to an expression that is dependent on a variable, such as the following:

If(cameraEnabled, DisplayMode.Edit, DisplayMode.Disabled)

You can now use a button, for example, to update the value of the 'cameraEnabled' variable. If you have the expression below in a button's OnSelect property, it will toggle the camera will be enabled / disabled when the button is clicked:

UpdateContext({cameraEnabled: !cameraEnabled})

If you have more than one camera control in your app, you can set the Disabled property of all of the controls to the same value.

 

As far as scanning a QR Code, PowerApps currently doesn't support it natively. One possibility would be to tap into the OnSelect property of the camera to call a custom API that processes the image that was captured. But that requires this custom API to exist (you could build one yourself if a public one doesn't exist).

View solution in original post

1 REPLY 1
Highlighted
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Disable phone's camera

You can disable the camera as it's being used in your app within PowerApps. You cannot disable the camera for all apps in the phone.

 

To disable the camera in your app, you can set the DisplayMode property of the camera control to an expression that is dependent on a variable, such as the following:

If(cameraEnabled, DisplayMode.Edit, DisplayMode.Disabled)

You can now use a button, for example, to update the value of the 'cameraEnabled' variable. If you have the expression below in a button's OnSelect property, it will toggle the camera will be enabled / disabled when the button is clicked:

UpdateContext({cameraEnabled: !cameraEnabled})

If you have more than one camera control in your app, you can set the Disabled property of all of the controls to the same value.

 

As far as scanning a QR Code, PowerApps currently doesn't support it natively. One possibility would be to tap into the OnSelect property of the camera to call a custom API that processes the image that was captured. But that requires this custom API to exist (you could build one yourself if a public one doesn't exist).

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (5,303)