QRCodeScanner
- Last UpdatedJan 13, 2025
- 3 minute read
The QRCodeScanner is a node available only on the XR-P platforms and is used to read QRCodes using the device’s camera.
-
There should only be one instance of the QRCodeScanner node in a project.
-
Scanning of QRCodes in the frame of the device camera happens only if QRCodeScanner node is active.
QRCodeScanner node requires access to the camera in order to function. When the QRCodeScanner node is activated, it checks whether the XRViewer App has been granted the Camera permission. When the app is running the first time, and on activating QRCodeScanner node, the user will be presented with a message dialog asking to grant the permission.
If the permission is denied by the user, QRCodeScanner node will not function and the Active field will be set to false. From the second time onwards, a different alert will be presented to the user that will prompt the user to go to the App Permission settings and grant camera permission (if the camera permission has been revoked or not granted the first time). The scriptwriter should be aware of this aspect of permissions. The scriptwriter can also make use of the Permission node to check or request permission before activating the QRCodeScanner node.
Note: The QRCodeScanner node requires camera permission on Android and IOS to work properly. If camera permission is denied, then QRCodeScanner shows no camera image to scan.
Platform support
This node is supported only on XR-Portable Windows, XR-Portable iOS and XR-Portable Android platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
No support |
Full support |
Full support |
Full support |
No support |
|
|
|
|
|
|
Showing the Device Camera
When the QRCodeScanner node is set to active, a rectangular frame showing the device’s camera input displays.
Code example
This is a code example for the QRCodeScanner node.
<QRCodeScanner name=" qr_scanner" mode="scan" active="false" />
QRCodeScanner fields
These are the fields for QRCodeScanner node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > QRCodeScanner
|
Fields |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
Activates and deactivates QR Code scanning and shows the camera image when set to true. |
|
mode |
senum |
Optional |
scan |
When set to scan, the node will look for QR codes until it finds one and then sets the active field to false. When set to continuous, the node will keep scanning until the active field is set to false regardless of whether it finds a QR code or not. |
|
qrcode |
sstring |
Read only |
This field shows the latest scanned QR Code value. |