# generateQRCode

## Description

Creates an image for a type of matrix barcode (QR Code).

## Input / Parameter

| Name  | Description                                                                 | Input Type | Default | Options | Required |
| ----- | --------------------------------------------------------------------------- | ---------- | ------- | ------- | -------- |
| type  | Not currently in use by the function.                                       | Text       | -       | -       | No       |
| value | The value to be attached to the QR code.                                    | Text       | -       | -       | Yes      |
| logo  | An image base64 or URL of an image to be appended to the QR Code.           | Text       | -       | -       | No       |
| extra | The value to be included to the 'callback' as a system value under 'extra'. | Any        | -       | -       | No       |

## Output

N/A

## Callback

### callback

It is executed after the function completeled generating the matrix barcode (QR Code).

| Description                     | Output Type |
| ------------------------------- | ----------- |
| Returns the image base64 value. | Text        |

## Example

In this example, we will generate a QR code and display it in an image component.

### Steps

1. Drag a `button` component and an `image` component to a page in the editor to display the generated QR code.

   ![](https://github.com/OrangeKloud/emobiq-documentation/blob/master/document/client/006-actions-and-visual-logic/action-reference/react-native/Device/generateQRCode/generateQRCode-step-1.png)
2. Call the function `Device.generateQRCode` in the `press` event of the button component and set the required parameters to generate the QR code.

   ```js
   value : test qrcode
   ```

   ![](/files/lqhpsBa1epDSQP3lVE5o)
3. Call the function `App.setComponentValue` if the function `Device.generateQRCode` runs successfully and set the value to display the QR code in the image component.

   ![](/files/PyRSmv35g7dTKO6Wvabo)
4. Call the function `Log.write` if the function `Device.generateQRCode` does not run successfully and set the value to print the response in the console.

   ![](/files/UWFfCLDZnTWFEYKs6pdn)

### Result

1. The image component will display the QR code generated if the function is executed successfuly and the console will print the base64 string of the image if the function is not executed successfully.

   ![](/files/pAAu4HN7KijQ4sQfDY0v)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/device/generateqrcode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
