cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Impactful Individual
Impactful Individual

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
mdevaney
Super User
Super User

@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
mdevaney
Super User
Super User

@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." 

Confirmed the solution above. Simple and elegant @mdevaney 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,184)