cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
stapes
Level 8

Is there a method of telling whether a device has barcode scanner or not?

Is it possible to tell from within the App, when it is running, whether the device you are running on can do barcode scan or not?

This would allow me to put in some extra logic so I do not have to add extra bits just for testing / building on a PC.

For instance, I could do manual entry of the codes where a scanner does not exist.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Is there a method of telling whether a device has barcode scanner or not?

@stapes 

While you can't directly ask PowerApps if the device is PC or mobile you can assume if the Acceleration variable is blank you are on a PC.  This is because a PC has no Accelerometer 🙂

 

I suggest using this code in the OnStart property of your app.

Set(deviceType, If(IsBlank(Acceleration.X), "PC", "Mobile"))

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Is there a method of telling whether a device has barcode scanner or not?

@stapes 

While you can't directly ask PowerApps if the device is PC or mobile you can assume if the Acceleration variable is blank you are on a PC.  This is because a PC has no Accelerometer 🙂

 

I suggest using this code in the OnStart property of your app.

Set(deviceType, If(IsBlank(Acceleration.X), "PC", "Mobile"))

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

GarethPrisk
Level: Powered On

Re: Is there a method of telling whether a device has barcode scanner or not?

Confirmed the solution above. Simple and elegant @mdevaney 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

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
Users online (5,339)