|
| 1 | +--- |
| 2 | +layout: default-layout |
| 3 | +title: BarcodeScannerConfig Class - Dynamsoft Barcode Reader Android Edition |
| 4 | +description: BarcodeScannerConfig of Dynamsoft Barcode Reader Android is the class that defines the configurations for BarcodeScanner component. |
| 5 | +keywords: scanner, activity, startCapturing, license |
| 6 | +needAutoGenerateSidebar: true |
| 7 | +needGenerateH3Content: true |
| 8 | +breadcrumbText: BarcodeScannerConfig |
| 9 | +--- |
| 10 | + |
| 11 | +# BarcodeScannerConfig |
| 12 | + |
| 13 | +`BarcodeScannerConfig` is the class that defines the configurations for barcode scanning. Once the `BarcodeScannerConfig` object is made, it is set via the `BarcodeScannerActivity.ResultContract`. |
| 14 | + |
| 15 | +## Definition |
| 16 | + |
| 17 | +*Assembly:* DynamsoftBarcodeReaderBundle.aar |
| 18 | + |
| 19 | +*Namespace:* com.dynamsoft.dbrbundle.ui |
| 20 | + |
| 21 | +```java |
| 22 | +final class BarcodeScannerConfig |
| 23 | +``` |
| 24 | + |
| 25 | +## Methods |
| 26 | + |
| 27 | +| Method | Description | |
| 28 | +| ------ | ----------- | |
| 29 | +| [`setLicense`](#setlicense) | Sets the license key for the Barcode Reader. | |
| 30 | +| [`setTemplateFilePath`](#settemplatefilepath) | Sets the parameters template for the Barcode Reader via a local JSON file path. | |
| 31 | +| [`setBarcodeFormats`](#setbarcodeformats) | Sets the barcode format(s) to read. | |
| 32 | +| [`setScanRegion`](#setscanregion) | Sets a scan region where only the barcodes located in the scan region can be decoded. | |
| 33 | +| [`setTorchButtonVisible`](#settorchbuttonvisible) | Sets whether to display the torch button when scanning or not. | |
| 34 | +| [`setBeepEnabled`](#setbeepenabled) | Sets whether to trigger a beep sound when a barcode is detected. | |
| 35 | +| [`setScanLaserVisible`](#setscanlaservisible) | Sets whether to display a scan laser when scanning. | |
| 36 | +| [`setAutoZoomEnabled`](#setautozoomenabled) | Sets whether to enable the auto-zoom feature when scanning. | |
| 37 | +| [`setCloseButtonVisible`](#setclosebuttonvisible) | Sets whether to display a button that can close the scanner page. | |
| 38 | +| [`getLicense`](#getlicense) | Returns the license key string. | |
| 39 | +| [`getTemplateFilePath`](#gettemplatefilepath) | Returns the file path of the template file if one is being used. | |
| 40 | +| [`isTorchButtonVisible`](#istorchbuttonvisible) | Returns whether the button is visible. | |
| 41 | +| [`getBarcodeFormats`](#getbarcodeformats) | Returns the barcode format(s) that the library will accept. | |
| 42 | +| [`getScanRegion`](#getscanregion) | Returns the scan region. | |
| 43 | +| [`isBeepEnabled`](#isbeepenabled) | Returns whether the beep sound is enabled. | |
| 44 | +| [`isScanLaserVisible`](#isscanlaservisible) | Returns whether the scan laser is visible. | |
| 45 | +| [`isAutoZoomEnabled`](#isautozoomenabled) | Returns whether the auto-zoom feature is enabled. | |
| 46 | +| [`isCloseButtonVisible`](#isclosebuttonvisible) | Returns whether the close button is visible. | |
| 47 | + |
| 48 | +### setLicense |
| 49 | + |
| 50 | +Sets the license key for the Barcode Reader. |
| 51 | + |
| 52 | +```java |
| 53 | +void setLicense(String license); |
| 54 | +``` |
| 55 | + |
| 56 | +**Parameter(s)** |
| 57 | + |
| 58 | +`license`: The license key to be used for initialization. |
| 59 | + |
| 60 | +### setTemplateFilePath |
| 61 | + |
| 62 | +Sets the local JSON file path that will configure the parameters template for the Barcode Reader. |
| 63 | + |
| 64 | +```java |
| 65 | +void setTemplateFilePath(String templateFilePath); |
| 66 | +``` |
| 67 | + |
| 68 | +**Parameter(s)** |
| 69 | + |
| 70 | +`templateFilePath`: The path of the JSON template file. |
| 71 | + |
| 72 | +### setBarcodeFormats |
| 73 | + |
| 74 | +Sets the barcode format(s) to read. |
| 75 | + |
| 76 | +```java |
| 77 | +void setBarcodeFormats(long format); |
| 78 | +``` |
| 79 | + |
| 80 | +**Parameter(s)** |
| 81 | + |
| 82 | +`format`: A combined value of [`EnumBarcodeFormat`]({{ site.dcvb_enumerations }}barcode-reader/barcode-format.html?lang=android) to specify which barcode format(s) the library should target. |
| 83 | + |
| 84 | +### setScanRegion |
| 85 | + |
| 86 | +Sets a scan region. Only the barcodes located in the scan region can be decoded. |
| 87 | + |
| 88 | +```java |
| 89 | +void setScanRegion(DSRect scanRegion); |
| 90 | +``` |
| 91 | + |
| 92 | +**Parameter(s)** |
| 93 | + |
| 94 | +`scanRegion`: A [`DSRect`]({{ site.dcvb_android_api }}core/basic-structures/rect.html) object that specifies the scan region. |
| 95 | + |
| 96 | +### setTorchButtonVisible |
| 97 | + |
| 98 | +Sets whether to display the torch button when scanning. User can click the torch button to turn on/off the torch. |
| 99 | + |
| 100 | +```java |
| 101 | +void setTorchButtonVisible(boolean torchButtonVisible); |
| 102 | +``` |
| 103 | + |
| 104 | +**Parameter(s)** |
| 105 | + |
| 106 | +`torchButtonVisible`: A boolean value that determines whether to display the torch button. |
| 107 | + |
| 108 | +### setBeepEnabled |
| 109 | + |
| 110 | +Sets whether to trigger a beep sound when a barcode is detected. |
| 111 | + |
| 112 | +```java |
| 113 | +void setBeepEnabled(boolean beepEnabled); |
| 114 | +``` |
| 115 | + |
| 116 | +**Parameter(s)** |
| 117 | + |
| 118 | +`beepEnabled`: A boolean value that determines whether to enable the beep sound. |
| 119 | + |
| 120 | +### setScanLaserVisible |
| 121 | + |
| 122 | +Sets whether to display a scan laser when scanning. |
| 123 | + |
| 124 | +```java |
| 125 | +void setScanLaserVisible(boolean scanLaserVisible); |
| 126 | +``` |
| 127 | + |
| 128 | +**Parameter(s)** |
| 129 | + |
| 130 | +`scanLaserVisible`: A boolean value that determines whether to display the scan laser. |
| 131 | + |
| 132 | +### setAutoZoomEnabled |
| 133 | + |
| 134 | +Sets whether to enable the auto-zoom feature when scanning. |
| 135 | + |
| 136 | +```java |
| 137 | +void setAutoZoomEnabled(boolean autoZoomEnabled); |
| 138 | +``` |
| 139 | + |
| 140 | +**Parameter(s)** |
| 141 | + |
| 142 | +`autoZoomEnabled`: A boolean value that determines whether to enable the auto-zoom feature. |
| 143 | + |
| 144 | +### setCloseButtonVisible |
| 145 | + |
| 146 | +Sets whether to display a button that can close the scanner page. |
| 147 | + |
| 148 | +```java |
| 149 | +void setCloseButtonVisible(boolean closeButtonVisible); |
| 150 | +``` |
| 151 | + |
| 152 | +**Parameter(s)** |
| 153 | + |
| 154 | +`closeButtonVisible`: A boolean value that determines whether to display the close button. |
| 155 | + |
| 156 | +### getLicense |
| 157 | + |
| 158 | +Returns the license key string. |
| 159 | + |
| 160 | +```java |
| 161 | +String getLicense(); |
| 162 | +``` |
| 163 | + |
| 164 | +**Return Value** |
| 165 | + |
| 166 | +The license key to be used for initialization. |
| 167 | + |
| 168 | +### getTemplateFilePath |
| 169 | + |
| 170 | +Get the file path of the template file. |
| 171 | + |
| 172 | +```java |
| 173 | +String getTemplateFilePath(); |
| 174 | +``` |
| 175 | + |
| 176 | +**Return Value** |
| 177 | + |
| 178 | +The path of the JSON template file. |
| 179 | + |
| 180 | +### getBarcodeFormats |
| 181 | + |
| 182 | +Returns the barcode format settings. |
| 183 | + |
| 184 | +```java |
| 185 | +long getBarcodeFormats(); |
| 186 | +``` |
| 187 | + |
| 188 | +**Return Value** |
| 189 | + |
| 190 | +A combined value of [`EnumBarcodeFormat`]({{ site.dcvb_enumerations }}barcode-reader/barcode-format.html?lang=android) to specify which barcode format(s) the library should target. |
| 191 | + |
| 192 | +### getScanRegion |
| 193 | + |
| 194 | +Returns the scan region. |
| 195 | + |
| 196 | +```java |
| 197 | +DSRect getScanRegion(); |
| 198 | +``` |
| 199 | + |
| 200 | +**Return Value** |
| 201 | + |
| 202 | +A [`DSRect`]({{ site.dcvb_android_api }}core/basic-structures/rect.html) object that specifies the scan region. |
| 203 | + |
| 204 | +### isTorchButtonVisible |
| 205 | + |
| 206 | +Returns a boolean indicating whether or not the torch button is visible. |
| 207 | + |
| 208 | +```java |
| 209 | +boolean isTorchButtonVisible(); |
| 210 | +``` |
| 211 | + |
| 212 | +**Return Value** |
| 213 | + |
| 214 | +A boolean value that determines whether the torch button is displayed. |
| 215 | + |
| 216 | +### isBeepEnabled |
| 217 | + |
| 218 | +Returns a boolean indicating whether or not the beep sound is enabled. |
| 219 | + |
| 220 | +```java |
| 221 | +boolean isBeepEnabled(); |
| 222 | +``` |
| 223 | + |
| 224 | +**Return Value** |
| 225 | + |
| 226 | +A boolean value that determines whether the beep sound is enabled. |
| 227 | + |
| 228 | +### isScanLaserVisible |
| 229 | + |
| 230 | +Returns a boolean indicating whether or not the scan laser is visible. |
| 231 | + |
| 232 | +```java |
| 233 | +boolean isScanLaserVisible(); |
| 234 | +``` |
| 235 | + |
| 236 | +**Return Value** |
| 237 | + |
| 238 | +A boolean value that determines whether the scan laser is displayed. |
| 239 | + |
| 240 | +### isAutoZoomEnabled |
| 241 | + |
| 242 | +Returns a boolean indicating whether or not the auto-zoom feature is enabled. |
| 243 | + |
| 244 | +```java |
| 245 | +boolean isAutoZoomEnabled(); |
| 246 | +``` |
| 247 | + |
| 248 | +**Return Value** |
| 249 | + |
| 250 | +A boolean value that determines whether the auto-zoom feature is enabled. |
| 251 | + |
| 252 | +### isCloseButtonVisible |
| 253 | + |
| 254 | +Returns a boolean indicating whether or not the close button is visible. |
| 255 | + |
| 256 | +```java |
| 257 | +boolean isCloseButtonVisible(); |
| 258 | +``` |
| 259 | + |
| 260 | +**Return Value** |
| 261 | + |
| 262 | +A boolean value that determines whether the close button is displayed. |
0 commit comments