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

How to check if Camera access is granted

So, Building an app and have integrated both the option for users to utilize their camera and upload pictures.  I wanted to see if there was a way to check if the users either:

1) Did not authorize access to the camera
2) No camera is present on the device
3) Something squirrely happens and camera isn't interfacing properly

 

Intent is to hide the camera icons and replace them with the upload icons if there is an issue accessing the camera feed for whatever reason. 

2 REPLIES 2
EricLott
Level 10

Re: How to check if Camera access is granted

This is an interesting one. I just put this together as a test. Put this code in your App's OnStart or Form's OnVisible property. I'm about to test this on my phone, I'll post my results.

 

ClearCollect(camTest,Camera1.Photo);
If(First(camTest.Url).Url="",Set(CameraError,true))

 

This had some promise on my desktop version (returned true for CameraError), however it's not behaving as expected on mobile.

MichaelRolen
Level: Powered On

Re: How to check if Camera access is granted

Like the idea - however seems to be behaving oddly - on this one control it's populating with a blank picture icon which seems to be throwing everything for a loop.  if I do it based on just the URL line you provided it always throws up Error (Yes I know my column name is Pictures - that's after some tinkering try to make it work), even with the camera pre-allowed (Remembered). If I try to do it as IsBlankorError it's always False, because technically there is something there I suppose.

Only other aspect to consider would be allowing for users to have a few moments to actually click the button - gotta make it harder, you had an idea to fast!

 

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 Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,996)