# MD for: https://www.mercadopago.com.br/developers/pt/docs/smartapps/resources/configure-camera-scanner.md \# Configure camera (scanner) One of the features of the Point terminal that can be used by your SmartApp is the camera as a QR code or barcode scanner, essential for in-person paymentssuch as Pix or boleto . In addition, it can also be used to scan QR codes specific to the establishment and product barcodes. To implement this feature, use the \`launchScanner\` method from the \`cameraScanner\` class within the \`MPManager\` object, and differentiate which type of code you want to scan through the \`ScanType\` class, which can be: - \`CAMERA\_SCANNER\_QR\`: represents QR code reading. - \`CAMERA\_SCANNER\_BARCODE\`: represents barcode reading. Additionally, through the \`ScannerFlowRequestData\` class you can also control some visual features of the \_scanner\_ screen: | Feature | Type | Description | |---|---|---| | \`isLanternOn\` | \_Boolean\_ | Indicates whether the scanner should open with the terminal's flashlight on. If yes, \`true\` and if no, \`false\`. This feature is not available for QR code reading, only for barcodes. | | \`initialOrientation\` | \_String\_ | Defines the initial orientation of the screen where the scanner will be displayed, which can be vertical or horizontal. The possible values are: \- \`null\`: the orientation will be determined by the default implementation of the scanner screen, which is currently always portrait (Portrait). \- \`0\`: orientation defined as landscape (Landscape). It is recommended to pass this value as \`ActivityInfo.SCREEN\_ORIENTATION\_LANDSCAPE\`. \- \`1\`: orientation defined as portrait (Portrait). It is recommended to pass this value as \`ActivityInfo.SCREEN\_ORIENTATION\_PORTRAIT\`. | See below an example of scanner feature implementation. * [java ](#editor%5F2) * [kotlin ](#editor%5F1) kotlin java ``` val cameraScanner = MPManager.cameraScanner /** * launch camera to scan QR code with request data **/ val requestData = ScannerFlowRequestData( isLanternOn = true, /** Control to turn on flashlight, boolean value true */ initialOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE /** Control for initial screen orientation as Landscape, int value 0 */ ) cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR, requestData) { response -> response .doIfSuccess { result -> /** Handle successful scanner result (result.message) */ } .doIfError { error -> /** Handle scanner error (error.message.orEmpty()) */ } } /** * launch camera to scan barcode with request data **/ val requestData = ScannerFlowRequestData( isLanternOn = false, /** Control to turn off flashlight, boolean value false */ initialOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT /** Control for initial screen orientation as Portrait, int value 1 */ ) cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_BARCODE, requestData) { response -> response .doIfSuccess { result -> /** Handle successful scanner result (result.message) */ } .doIfError { error -> /** Handle scanner error (error.message.orEmpty()) */ } } ``` Copiar ``` final CameraScanner cameraScanner = MPManager.INSTANCE.getCameraScanner(); final ScannerFlowRequestData requestData = ScannerFlowRequestData(true, 0); final Function, Unit> callback = new Function, Unit>() { @Override public Unit apply(MPResponse response) { if (response.getStatus() == ResponseStatus.SUCCESS) { // Handle successful response CameraScannerResponse cameraScannerResponse = response.getData(); String result = cameraScannerResponse.getMessage(); // ... Do something with the result } else { // Handle error in response String errorMessage = response.getError(); // ... Do something with the error } return Unit.INSTANCE; } }; /** * Launch QR or barcode camera scanner with requestData and callback * ScanType.CAMERA_SCANNER_QR is the type to launch camera to read QR * ScanType.CAMERA_SCANNER_BARCODE is the type to launch camera to read barcode */ cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR, requestData, callback); ``` Copiar