การสแกนบาร์โค้ด
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ

คุณจะอ่านข้อมูลที่เข้ารหัสโดยใช้รูปแบบบาร์โค้ดมาตรฐานส่วนใหญ่ได้ด้วย API การสแกนบาร์โค้ดของ ML Kit การสแกนบาร์โค้ดจะเกิดขึ้นในอุปกรณ์และไม่จำเป็นต้องมีการเชื่อมต่อเครือข่าย
บาร์โค้ดเป็นวิธีที่สะดวกในการส่งข้อมูลจากโลกแห่งความเป็นจริงไปยังแอปของคุณ โดยเฉพาะอย่างยิ่ง เมื่อใช้รูปแบบ 2 มิติ เช่น คิวอาร์โค้ด คุณสามารถเข้ารหัสข้อมูลที่มีโครงสร้าง เช่น ข้อมูลติดต่อหรือข้อมูลเข้าสู่ระบบเครือข่าย Wi-Fi ได้ เนื่องจาก ML Kit จดจำและแยกวิเคราะห์ข้อมูลนี้ได้โดยอัตโนมัติ แอปของคุณจึงตอบสนองได้อย่างมีประสิทธิภาพเมื่อผู้ใช้สแกนบาร์โค้ด
สำหรับผู้ใช้ที่ไม่จำเป็นต้องใช้ UI ที่กำหนดเอง เราขอแนะนำให้ใช้เครื่องมือสแกนโค้ดของ Google API เครื่องสแกนโค้ดใช้รูปแบบการอนุมานเดียวกันกับ API การสแกนบาร์โค้ดมาตรฐาน แต่จะแสดงผลเฉพาะบาร์โค้ดส่วนกลางมากที่สุดเพื่อประสบการณ์ที่รวดเร็วและสอดคล้องกันมากขึ้น นอกจากนี้ เครื่องมือสแกนโค้ดของ Google ยังปลอดภัยกว่าและไม่ต้องใช้สิทธิ์ รวมถึงไม่จำเป็นต้องมีการติดตั้งใช้งานหรือสิทธิ์เกี่ยวกับกล้อง
iOS
Android
Google Code Scanner
ความสามารถหลัก
- อ่านรูปแบบมาตรฐานส่วนใหญ่
- รูปแบบเชิงเส้น: Codabar, Code 39, Code 93, Code 128, EAN-8, EAN-13, ITF, UPC-A, UPC-E
- รูปแบบ 2 มิติ: Aztec, Data Matrix, PDF417, คิวอาร์โค้ด
- การตรวจหารูปแบบอัตโนมัติ
- สแกนหารูปแบบบาร์โค้ดที่รองรับทั้งหมดได้พร้อมกันโดยไม่ต้องระบุรูปแบบที่ต้องการ หรือเพิ่มความเร็วในการสแกนโดยจำกัดให้ตัวตรวจจับเฉพาะรูปแบบที่คุณสนใจ
- แยก Structured Data
- ระบบจะแยกวิเคราะห์ข้อมูลที่มีโครงสร้างซึ่งจัดเก็บโดยใช้รูปแบบ 2 มิติที่รองรับรูปแบบใดรูปแบบหนึ่งโดยอัตโนมัติ ประเภทข้อมูลที่รองรับ ได้แก่ URL, ข้อมูลติดต่อ, กิจกรรมในปฏิทิน, อีเมล, หมายเลขโทรศัพท์, ข้อความแจ้งข้อความ SMS, ISBN, ข้อมูลการเชื่อมต่อ Wi-Fi, สถานที่ตั้งทางภูมิศาสตร์ และข้อมูลผู้ขับตามมาตรฐาน AAMVA
- ใช้งานได้กับทุกการวางแนว
- ระบบจะจดจำและสแกนบาร์โค้ดได้ไม่ว่าจะอยู่ในแนวใด ไม่ว่าจะเป็นการขึ้นบนขวา การกลับหัวกลับหาง หรือตะแคงข้าง
- ทำงานในอุปกรณ์
- การสแกนบาร์โค้ดจะดำเนินการบนอุปกรณ์อย่างสมบูรณ์และไม่ต้องเชื่อมต่อเครือข่าย
โปรดทราบว่า API นี้ไม่รู้จักบาร์โค้ดในแบบฟอร์มต่อไปนี้:
- บาร์โค้ด 1 มิติที่มีอักขระเพียงตัวเดียว
- บาร์โค้ดในรูปแบบ ITF ที่มีอักขระน้อยกว่า 6 ตัว และเป็นที่ทราบว่ารูปแบบนี้ไม่สม่ำเสมอเนื่องจากไม่มีการตรวจสอบข้อผิดพลาด
- บาร์โค้ดที่เข้ารหัสด้วย FNC2, FNC3 หรือ FNC4
- คิวอาร์โค้ดที่สร้างขึ้นในโหมด ECI
API นี้จดจำบาร์โค้ดได้ไม่เกิน 10 ตัวต่อการเรียก API
ตัวอย่างผลการแข่ง
|
ผลลัพธ์ |
คอร์นเนอร์ |
(49,125), (172,125), (172,160), (49,160) |
ค่าข้อมูลดิบ |
2404105001722 |
|
|
ผลลัพธ์ |
คอร์นเนอร์ |
(87,87) (612,87) (612,612) (87,612) |
ค่าข้อมูลดิบ |
WIFI:S:SB1Guest;P:12345;T:WEP;; |
ข้อมูล Wi-Fi |
SSID |
SB1Guest |
รหัสผ่าน |
12345 |
ประเภท |
WEP |
|
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[[["\u003cp\u003eML Kit's Barcode Scanning API reads data from most standard barcode formats, including linear and 2D formats, without needing an internet connection.\u003c/p\u003e\n"],["\u003cp\u003eIt automatically detects and parses structured data like contact info, WiFi credentials, and more from supported 2D formats, enabling intelligent app responses.\u003c/p\u003e\n"],["\u003cp\u003eThe API works offline, recognizing barcodes in any orientation, and the Google Code Scanner offers a faster, safer, and permissionless option for basic scanning needs.\u003c/p\u003e\n"],["\u003cp\u003eWhile it supports a wide range of formats and data types, the API has limitations regarding certain 1D barcodes, ITF formats, and QR codes with specific encodings, recognizing a maximum of 10 barcodes per call.\u003c/p\u003e\n"]]],["ML Kit's barcode scanning API reads data from most standard barcode formats on the device without needing a network connection. It automatically detects and parses structured data from 2D formats like QR codes, recognizing information such as URLs, contact details, and WiFi credentials. The API supports various linear and 2D formats, works with any barcode orientation, and offers a Google code scanner option for a faster, safer, permission-less experience. It does not recognize some formats including some 1D and ITF barcodes.\n"],null,["With ML Kit's barcode scanning API, you can read data encoded using most\nstandard barcode formats. Barcode scanning happens on the device, and doesn't\nrequire a network connection.\n\nBarcodes are a convenient way to pass information from the real world to your\napp. In particular, when using 2D formats such as QR code, you can encode\nstructured data such as contact information or WiFi network credentials. Because\nML Kit can automatically recognize and parse this data, your app can respond\nintelligently when a user scans a barcode.\n\nFor users who don't require custom UI, we recommend using the\n[Google code scanner](/ml-kit/vision/barcode-scanning/code-scanner). The code\nscanner API uses the same inference model as the standard Barcode scanning API,\nbut returns only the most centralized barcode for a faster and more consistent\nexperience. Google code scanner is also safer and permission-less, and does not\nrequire camera-related implementation or permissions.\n\n[iOS](/ml-kit/vision/barcode-scanning/ios)\n[Android](/ml-kit/vision/barcode-scanning/android)\n[Google code scanner](/ml-kit/vision/barcode-scanning/code-scanner)\n\nKey capabilities\n\nReads most standard formats\n:\n - Linear formats: Codabar, Code 39, Code 93, Code 128, EAN-8, EAN-13, ITF, UPC-A, UPC-E\n - 2D formats: Aztec, Data Matrix, PDF417, QR Code\n\nAutomatic format detection\n: Scan for all supported barcode formats at once without having to specify\n the format you're looking for, or boost scanning speed by restricting the\n detector to only the formats you're interested in.\n\nExtracts structured data\n: Structured data that's stored using one of the supported 2D formats is\n automatically parsed. Supported information types include URLs,\n contact information, calendar events, email addresses, phone\n numbers, SMS message prompts, ISBNs, WiFi connection information,\n geographic location, and AAMVA-standard driver information.\n\nWorks with any orientation\n: Barcodes are recognized and scanned regardless of their orientation:\n right-side-up, upside-down, or sideways.\n\nRuns on the device\n: Barcode scanning is performed completely on the device, and doesn't\n require a network connection.\n\nNote that this API does not recognize barcodes in these forms:\n\n- 1D Barcodes with only one character\n- Barcodes in ITF format with fewer than six characters, and this format is known to be flaky due to absence of checksum\n- Barcodes encoded with FNC2, FNC3 or FNC4\n- QR codes generated in the ECI mode\n\nThis API recognizes no more than 10 barcodes per API call.\n\nExample results\n\n|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | | Result || |---------------|------------------------------------------| | **Corners** | (49,125), (172,125), (172,160), (49,160) | | **Raw value** | 2404105001722 | |\n\n|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | | Result || |----------------------|-----------------------------------------------------------------------------------------------------------------| | **Corners** | (87,87) (612,87) (612,612) (87,612) | | **Raw value** | `WIFI:S:SB1Guest;P:12345;T:WEP;;` | | **WiFi information** | |--------------|----------| | **SSID** | SB1Guest | | **Password** | 12345 | | **Type** | WEP | | |"]]