Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
| class info |
| com.huawei.hms.hmsscankit.ScanUtil |
| Barcode scanning tool class, which is used to check permissions and start the barcode scanning page. This class provides the Default View and Bitmap modes for barcode scanning and a QR code generation API. |
| Type | Name | Desc |
| int | SUCCESS | The code scanning view can be started. |
| int | ERROR_NO_CAMERA_PERMISSION | No camera permission. |
| int | ERROR_NO_READ_PERMISSION | No read permission. |
| String | RESULT | Defines the result key. |
| Constant |
| public static final int SUCCESS |
| The code scanner view can be started. Constant Value: 0 |
| Constant |
| public static final int ERROR_NO_CAMERA_PERMISSION |
| No camera permission. Constant Value: 1 |
| Constant |
| public static final int ERROR_NO_READ_PERMISSION |
| No read permission. Constant Value: 2 |
| Constant |
| public static final String RESULT |
Defines the result key. Constant Value: SCAN_RESULT |
Parameters
| Parameter name | Parameter desc |
| activity | A scanning request activity. |
| requestCode | A scanning request code, which is used to check whether the activity is returned by the code scanning view. |
| option | Barcode scanning format option. |
Return
| Type | desc |
| int | Scanning request result status. The values SUCCESS, ERROR_NO_CAMERA_PERMISSION, and ERROR_NO_READ_PERMISSION indicate a successful request, no camera permission, and no storage permission, respectively. |
| Method |
| public static HmsScan[] decodeWithBitmap(android.content.Context context, android.graphics.Bitmap bitmap, HmsScanAnalyzerOptions format) |
| Bitmap decoding API. |
Parameters
| Parameter name | Parameter desc |
| context | Request context, which is generally the activity object that is being called, for example MainActivity.this. |
| bitmap | Image to be decoded. For optimal effect, it is recommended that the image resolution range from 960px × 540px to 1920px × 1080px, with a maximum image size of 50 MB. |
| format | Specified barcode scanning format. |
Return
| Type | desc |
| HmsScan[] | Image decoding result. |
public static android.graphics.Bitmap buildBitmap(String content, int type, int width, int height, HmsBuildBitmapOption options) throw WriterException
Generates 1D or 2D barcodes.
Parameters
| Generated QR code image.Type | desc |
| content | QR code content. |
| type | Barcode format. |
| width | Width of a QR code to be generated. |
| height | Height of a QR code to be generated. |
| options | Barcode generation option. |
Return
| Type | desc |
| android.graphics.Bitmap | Barcode. |
Throws
| Type | desc |
| WriterException | Barcode generation exception. |
Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Quick start
Helps you find desired resources with ease.