当前位置:网站首页>Check whether there is a QR code in the picture
Check whether there is a QR code in the picture
2022-06-10 16:28:00 【InfoQ】
Requirement specification
Configuration work
androidXbuild.gradle// Whether there is QR code in the code scanning picture
implementation 'com.huawei.agconnect:agconnect-core:1.4.0.300'
implementation 'com.huawei.hms:scanplus:1.2.4.300'
build.gradle// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {url 'https://developer.huawei.com/repo/'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
onActivityResult()@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (resultCode == RESULT_OK) {
try {
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), data.getData());
//“QRCODE_SCAN_TYPE ” and “ DATAMATRIX_SCAN_TYPE It means scan only QR and Data Matrix Code of
HmsScanAnalyzerOptions options = new HmsScanAnalyzerOptions.Creator().setHmsScanTypes(HmsScan.QRCODE_SCAN_TYPE, HmsScan.DATAMATRIX_SCAN_TYPE).setPhotoMode(true).create();
HmsScan[] hmsScans = ScanUtil.decodeWithBitmap(this, bitmap, options);
// Process scan results
if (hmsScans != null && hmsScans.length > 0) {
// Show scan results
showResult(hmsScans);
Toast.makeText(this, " Find the QR code ", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, " QR code not found ", Toast.LENGTH_SHORT).show();
}
} catch (IOException e) {
e.printStackTrace();
}
}
super.onActivityResult(requestCode, resultCode, data);
}
private void showResult(HmsScan[] hmsScans) {
for (int i = 0; i < hmsScans.length; i++) {
Log.e(TAG, hmsScans[i].showResult);
}
}
- Read and write file permissions in the manifest file must be added
- Dynamic application permission must be added in the code ( Omitted from example )
- adapter Android7.0+ Uri Cannot be called by other applications ``FileUriExposedException` Abnormal problems ( Omitted from example )
//data yes Intent type ,data.getData Is the barcode image to be scanned Uri
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, REQUEST_OK);
Summary
zxing边栏推荐
- Smart home (3) competitive product analysis of Intelligent Interaction
- AttributeError: module ‘gym. envs. Box2d 'has no attribute' lunarlander 'solution
- Pytorch installation tutorial
- Necessary tools for automatic operation and maintenance shell script introduction
- Zhangxiaobai teaches you how to use Ogg to synchronize Oracle 19C data with MySQL 5.7 (1)
- Join operation cases in the reduce phase of MapReduce
- I used Matlab to reproduce the trembling sonic boom Fire Games Apple snake
- [object].
- 运行mapreduce任务缺失setJarByClass()报错找不到类
- New York financial regulators issue official guidelines for stable currency
猜你喜欢
![2D human pose estimation with residual log likelihood estimation (RLE) [link only]](/img/c7/9c25da07236ef0bd241b6023e82306.gif)
2D human pose estimation with residual log likelihood estimation (RLE) [link only]

Online document collaboration tool is the first step to improve work efficiency

SQL language

Application scenario introduction of nixie tube driver chip + voice chip, wt588e02b-24ss

Diagram of the quarterly report of station B: the revenue is RMB 5.1 billion, with a year-on-year increase of 30% and nearly 300million monthly active users

Save a window with a specific size, resolution, or background color

MapReduce案例之排序

Interpretation of cube technology | past and present life of cube Rendering Design
![Google X开源抓取机械臂,无需人工标注就能一眼找到目标零件[转]](/img/69/02a3e0eeaf3049f41b118cf0c58972.jpg)
Google X开源抓取机械臂,无需人工标注就能一眼找到目标零件[转]

Live broadcast preview | deconstruct OLAP! The new multidimensional analysis architecture paradigm is fully open! Apache Doris will bring five big issues!
随机推荐
SQL language
姿态估计之2D人体姿态估计 - (OpenPose) Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields
Missing setjarbyclass() when running MapReduce task. No class found
Distribution aware coordinate representation for human pose estimation
2D human posture estimation for posture estimation - numerical coordinate progression with revolutionary neural networks (dsnt)
NanoMQ Newsletter 2022-05|v0.8.0 发布,新增 WebHook 拓展接口和连接认证 API
Devops-1- introduction
Four Byron poems translated from heartless sword
Software College of Shandong University Project Training - Innovation Training - network security range experimental platform (XVII)
测试用例常用方法和选择原则
Aggregate sum of MapReduce cases
Kubernetes binary installation (v1.20.16) (V) verifying master deployment
MapReduce之Map阶段的join操作案例
Software test architects, 16 pieces of advice for future generations, take a look and don't miss it
[MySQL basics]
Common sense: the number of neurons in the brain of mice is about 70million and that of humans is about 86billion
Zhangxiaobai teaches you how to use Ogg to synchronize Oracle 19C data with MySQL 5.7 (1)
Devops-3 cloud computing and cloud era operation and maintenance
PV operation daily question - Restaurant Service
Why__ Inline usually needs static