You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I followed the sample at https://v2.tauri.app/plugin/barcode-scanner/,but never got Scanned result after calling scan.
The camera icon showed on the top-right corner of the screen, and keeps while the app runs, but no any result returns.
Also I tried to set scan({ windowed: false, formats: [Format.QRCode] });, it shows the camera screen, and never response, no matter how i scan the qr code.
I'm using XiaoMi 13 with HyperOS, android version 14
The project using automatic install with npm run tauri add barcode-scanner, then the related code as follows: src-tauri/Cargo.toml:
import{useEffect,useState}from"react";import{platform}from"@tauri-apps/plugin-os";import{scan,cancel,Format,checkPermissions,requestPermissions}from"@tauri-apps/plugin-barcode-scanner";import"./Scanner.css";functionScanner(){const[scanResult,setScanResult]=useState<string>("");const[currentPlatform,setCurrentPlatform]=useState<string>("");useEffect(()=>{constfetchPlatform=async()=>{constplatformName=awaitplatform();setCurrentPlatform(platformName);};fetchPlatform();},[currentPlatform]);consthandleScan=async()=>{//alert("Current Platform: " + currentPlatform);if(["android","ios"].includes(currentPlatform)){try{constpermissions=awaitcheckPermissions();if(permissions!=="granted"){constrequestResult=awaitrequestPermissions();if(requestResult!=="granted"){alert("Camera permission is required to scan QR codes.");return;}}constresult=awaitscan({windowed: true,formats: [Format.QRCode]});//await cancel();//alert("QR code scanning result: " + result.content);setScanResult(result.content);}catch(error){alert("QR code scanning failed: "+error);console.error("QR code scanning failed:",error);}}else{alert("QR code scanning is only supported on Android and iOS platforms.");}};consthandleCopy=()=>{navigator.clipboard.writeText(scanResult);alert("Text copied to clipboard!");};return(<divclassName="scanner-container"><buttononClick={handleScan}>Scan QR Code</button><textareavalue={scanResult}rows={5}readOnlyclassName="scan-result"/><buttononClick={handleCopy}>Copy Text</button></div>);}exportdefaultScanner;
The text was updated successfully, but these errors were encountered:
I also encountered the same problem, my device is android 14。tauri-plugin-barcode-scanner = "2"。
The old version of andorid 10 works fine, but android 14 doesn't. The model of my problematic device is iqoo neo9, andorid 14
I followed the sample at https://v2.tauri.app/plugin/barcode-scanner/,but never got Scanned result after calling scan.
The camera icon showed on the top-right corner of the screen, and keeps while the app runs, but no any result returns.
Also I tried to set
scan({ windowed: false, formats: [Format.QRCode] });
, it shows the camera screen, and never response, no matter how i scan the qr code.I'm using XiaoMi 13 with HyperOS, android version 14
The project using automatic install with
npm run tauri add barcode-scanner
, then the related code as follows:src-tauri/Cargo.toml
:src-tauri/src/lib.rs
src-tauri/capabilities/mobile.json
src/Features/Scanner.tsx
The text was updated successfully, but these errors were encountered: