LESSON

Barcode Scanned

Description

Learn how to use the Ignition Perspective App to process a scanned barcode on a mobile device.

Video recorded using: Ignition 8.0

Transcript

(open in window)

[00:00] The Ignition Perspective App has the ability to take advantage of special features of smartphones or other mobile devices. The Scan Barcode Action can make use of a mobile device's built in camera. Here I have simple view that contains a Label and a Button. The Label simply has a binding on its text property. The binding is pointing at the new tag that I have set up, which has the phrase "Please scan a barcode". The Button which says "Scan Barcode" has an onClick event configured with the action Scan Barcode. If you want you can configure a barcode type, or leave it to look for any type of barcode. Now this action simply turns on the camera and allows us to scan a barcode, but what we actually do with that barcode data is determined by a script somewhere else within the project. This script is located in the Session Event scripts, which we can access by going into the Project menu, and then selecting "Session Events". Here we have a Barcode Scanned event, which we can use to handle the incoming data whenever we scan a barcode. Here we have a very simple script that I've set up. Barcodes can contain a lot of different information, but I know the barcode that I've created simply contains some text. My script here is simply taking that text and writing that value to the new tag that I have set up, that's bound to my Label. I have an emulated mobile device set up, that's already running my project where we can test this out. I'm going to go ahead and click on the "Scan Barcode" Button, and if this is the first time you're trying to use the camera from the Perspective project, you may get a prompt that looks something like this. Like most other apps, the Ignition Perspective app needs to ask for permission before it can use various features of your mobile device. I'm going to go ahead and click "Allow" so that we can use the camera. We see my barcode there on the table, and Ignition will scan that barcode. You'll notice once it was able to identify the barcode it scanned in its data, which my script then used to write that text to my tag. Since my tag updated, my Label then showed the new tag value, which simply says "Perspective is great!" While this was a relatively simple example, barcodes can hold almost any type of information, so you can imagine I can scan a barcode that might return some data about a product that I'm currently looking at. I can then use my script to take that data and push it somewhere like tags, or even a database.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.