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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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