Skip to content
This repository has been archived by the owner on Apr 21, 2024. It is now read-only.
/ QRCode-Android Public archive

二维码、条形码通用扫描(已停止维护)

Notifications You must be signed in to change notification settings

XuDaojie/QRCode-Android

Repository files navigation

QRCode

minSdkVersion >= 14 本项目依赖于ZXing 3.2.1
Scan

Use

Add permission

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Register activity

<activity android:name="io.github.xudaojie.qrcodelib.CaptureActivity"/>

Code

Intent i = new Intent(mContent, CaptureActivity.class);
startActivityForResult(i, REQUEST_QR_CODE);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK
            && requestCode == REQUEST_QR_CODE
            && data != null) {
        String result = data.getStringExtra("result");
        Toast.makeText(MainActivity.this, result, Toast.LENGTH_SHORT).show();
    }
}

Including in your project

Add repository

想引入你的项目,需要修改你的build.gradle

repositories {
    maven { url "http://repo1.maven.org/maven2" }
    maven { url 'https://jitpack.io' }
}

Add dependency

compile('com.github.XuDaojie:QRCode-Android:v0.1.0', {
    exclude group: 'com.android.support'
})
// 6.0权限控制需要support支持
compile 'com.android.support:appcompat-v7:$supportVersion'

吃水不忘挖井人

ZXing
zxing扫描二维码和识别图片二维码及其优化策略

About

二维码、条形码通用扫描(已停止维护)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages