[RETIRED ] Android camera easy access library and embedded QR (and other codes) scanner, based on ZXing

Related tags

QRCode CamView
Overview

Retirement Notice

This project is retired and no longer maintained. Unfortunately I do not have enough time to supoprt it in a quality way and also there are number of much better camera / qr scanner libs for Android around.

CAMView

Android library with simple yet powerful components for using device camera in your apps.

The library contains a set of components (views), ready to be put to your layout files in order to give developer instant access to the following features:

  • Instantly display the live preview video feed from the device camera
  • Scan barcodes (using built-in ZXing decoding engine)
  • Perform your own camera live data processing

Library automatically uses old or new (V2) Android Camera API, depending on your OS version

The main goal of this project is to have a simple and clean components, ready to be put to an existing view hierarchy of any existing activity, fragment or just to a layout file like any other Android component such as TextView, ImageView, etc.

CAMView takes and hides all the dirty work and hacks for handling the low level routines, such as camera initialization, configuration, streaming, orientation changes, device and cameras compatibility, threading, etc, etc, etc.

Simply put the appropriate view component to your layout and your app is camera-ready.

Status

  • Current version: Download

Get It

  • Maven repository: jCenter
  • Group: eu.livotov.labs.android
  • Artifact ID: CAMView
compile ('eu.livotov.labs.android:CAMView:2.0.1@aar') {transitive=true}

Usage

Usage is very straightforward:

  1. Add the right component to your layout.xml (either in xml or programmatically at runtiume):
  • eu.livotov.labs.android.camview.CameraLiveView - if you want to display the live stream from the camera (and optionally want to process the captured feed).
  • eu.livotov.labs.android.camview.ScannerLiveView - if your goal is to scan barcodes. ScannerLiveView is ready to use barcode scanner.
  1. Get the CameraLiveView or ScannerLiveView instance and start the desired camera:
  • startCamera() for the CameraLiveView or startScanner() for the ScannerLiveView
  • If you want to work with the specific camera, get the available cameras list getAvailableCameras() and pass the selected one into the startCamera(...) or startScanner(...) method.
  1. For barcodes recognition, set your barcode listener into the ScannerLiveView instance: setScannerViewEventListener(...)

  2. When your activity stops, do not forget to release the camera and stop all previews and working threads by calling : stopCamera() or stopScanner() on appropriate LiveCameraView or LiveScannerView instance.

Documentation

More documentation will be added on release.

Contribute

Contribution wanted ! Please feel free to share your bugs, feature requests and pull requests of course. The "Issues" section is waiting for you :)

Comments
  • Preserve Aspect Ratio

    Preserve Aspect Ratio

    I need to have Scanner width of let say 200dp but I want it to calculate height depending on the aspect ratio of the camera. Does CamView provide for that? I think something like resize(w, h) where if w or h is -1 you would resize preserving aspect ratio

    opened by mtangoo 16
  • executing error

    executing error

    Hi, how are you... I'm trying this library and first I had a problem with the AppCompat library, so I declared it in the dependencies as follows:

    compile ('eu.livotov.labs:camview:2.0.0.DEV1-SNAPSHOT@aar') { transitive=true exclude module:'appcompat-v7' }

    And it worked fine, so I continued with the coding and when it's time to execute the program it throws the following message:

    Error:Execution failed for task ':app:dexDebug'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2

    I assume that's a problem with libraries and incompatibilities... So what should I do?

    thanks :)

    opened by carlosnavas91 12
  • NullpointerException for switch flash on/off

    NullpointerException for switch flash on/off

    UPDATE

    I tried the code below you provided and it gives nullpointer exception

    (Heading was Add ability to switch flash on/off) It will be nice to be able to switch camera flash on/off. pseudocode

    scanner.start();
    if(scanner.hasFlash())
        scanner.switchOn()
    
    
    opened by mtangoo 11
  • in old version i can`t stoped(to release the camera) the camera

    in old version i can`t stoped(to release the camera) the camera

    I can`t stop the camera for free a camera process for other applications.

    @Override
    public void onBackPressed() {
        scanner.stopScanner();
        super.onBackPressed();
    
    }
    
    @Override
    protected void onPause() {
        scanner.stopScanner();
        super.onPause();
    }
    
    /*@Override
    protected void onStop() {
        scanner.stopScanner();
        super.onStop();
    }*/
    
    @Override
    protected void onResume() {
        scanner.startScanner();
        super.onResume();
    }
    
    @Override
    protected void onDestroy() {
        scanner.stopScanner();
        scanner = null;
        super.onDestroy();
    }
    
    opened by Y-E-P 11
  • Size of Scanning Area

    Size of Scanning Area

    Currently scanning area is very small (red rectangle) and it makes hard to scan and adding time for recise scanning. I tried my a agains This App and mine took time to put QR code right under the scanner.

    Is there a way to increase (or at least provide a way) to make something like linked in app?

    opened by mtangoo 4
  • Installing on Maven Latest

    Installing on Maven Latest

    I want to install 2.0.0.DEV1-SNAPSHOT (latest). Putting in version does not work. Would you update the installation guide (telling us what to put in "version" in gradle, instead of x.y.z) for getting the latest?

    I'm sorry that am not Gradle/Maven maverick if this is obvious! S.

    opened by mtangoo 4
  • galaxy s6 camera preview is stretched

    galaxy s6 camera preview is stretched

    Moved from zxscanview project, reported by @Leaghte https://github.com/Leaghte

    Hi , i tested lib on few devices. Working fine, but on galaxy s6 camera preview is stretched. See the picture below. HUD is not in the middle :(

    opened by livotov 4
  • Fixed issue #26 with startPreview on Api Level 9

    Fixed issue #26 with startPreview on Api Level 9

    I fixed the error with api level 9. The adjustSurfaceHolderPre11() was added to late to the surfaceholder. It must be added before the surface is added to the view. Now it works with the ideos x3.

    I fixed also the breaking build (typo was corrected in layout but not in strings.xml) which was added by Livin21 from his last pull request.

    opened by rzetzsche 3
  • Why is the callback for onCodeScanned() missing on

    Why is the callback for onCodeScanned() missing on "duplicated" scans?

    I noticed how onCodeScanned() is not called properly as expected (in the front scanner?). Scanning 3 QR codes (in random order) with different content, say 1, 2, 3 and afterwards scanning a different code from the last one. So say: 1, 3, 2, 1

    Then for the last 1 the callback is not called anymore. Is this a bug on my side? I tried lowering the timeouts to 0 and messing around with calling stopScanner() and startScanner() in the callback but I never got it to scan the last number.

    Am I doing something wrong or is this feature intentionally not supported?

    question 
    opened by Dima-369 3
  • Update Readme

    Update Readme

    I switched from zxscanlib to camview yesterday and was a little confused in the beginning as to why it wasn't able to find the maven fragment. Solution was the version name actually contained a "-" instead of a "." :P

    Also you might want to mention in the readme: when including camview through gradle/maven you should include it with {transitive=true} like you described in the zxscanlib readme

    For me everything works smooth now, thanks for your work :)

    opened by wlky 3
  • Camera not starting

    Camera not starting

    i compiled your project , coded like in the test app ,but camera is not working showing an error in the toast like Scanner error : Camera system error 1

    opened by ameenmaheen 2
  • help me !!

    help me !!

    my project using camview, and when i run, show error like this: Error:(47, 28) error: method execPool in class CAMViewAsyncTask<Params,Progress,Result> cannot be applied to given types; required: CAP#1[] found: no arguments reason: formal varargs element type CAP#1 is not accessible from class AutoFocusManager where Params,Progress,Result are type-variables: Params extends Object declared in class CAMViewAsyncTask Progress extends Object declared in class CAMViewAsyncTask Result extends Object declared in class CAMViewAsyncTask where CAP#1 is a fresh type-variable: CAP#1 extends Object from capture of ?

    anyone help me?

    opened by donny26utama 0
  • Callback buffer was too small

    Callback buffer was too small

    Hi,

    I am getting buffer error when starting camera using ScannerLiveView's startScanner() function. I am running on Android Marshmallow 6 using the latest version of your library. I have also added camera permission in Android manifest file.

    E/Camera-JNI: Callback buffer was too small! Expected 460800 bytes, but got 259200 bytes!
    E/Camera-JNI: Couldn't allocate byte array for JPEG data
    E/Camera-JNI: Callback buffer was too small! Expected 460800 bytes, but got 259200 bytes!
    E/Camera-JNI: Couldn't allocate byte array for JPEG data
    

    Update - A clean and rebuild solved the issue, I can see camera now, so I think Android Studio might have been culprit. However, I am still getting the above error in my logcat. Should I be worried about it?

    opened by rohankandwal 0
  • Issue Nexus 5

    Issue Nexus 5

    Hello,

    i noticed that the old library was deprecated which is now linking here. Thanks for going on with the project !

    Anyways i have trouble with the new Library, my Nexus 5 is not working anymore:

    heres ADB Output:

    07-16 12:57:58.439 10641-10641/eu.livotov.labs.android.camview.test I/art: Late-enabling -Xcheck:jni
    07-16 12:57:58.528 10641-10641/eu.livotov.labs.android.camview.test W/System: ClassLoader referenced unknown path: /data/app/eu.livotov.labs.android.camview.test-2/lib/arm
    07-16 12:57:58.915 10641-10651/eu.livotov.labs.android.camview.test W/art: Suspending all threads took: 9.173ms
    07-16 12:57:58.935 10641-10651/eu.livotov.labs.android.camview.test I/art: Background sticky concurrent mark sweep GC freed 28065(1345KB) AllocSpace objects, 0(0B) LOS objects, 38% free, 14MB/23MB, paused 9.633ms total 160.657ms
    07-16 12:57:58.946 10641-10651/eu.livotov.labs.android.camview.test W/art: Suspending all threads took: 9.336ms
    07-16 12:57:59.068 10641-10641/eu.livotov.labs.android.camview.test I/CameraManagerGlobal: Connecting to camera service
    07-16 12:57:59.182 10641-10699/eu.livotov.labs.android.camview.test W/CameraBase: An error occurred while connecting to camera: 0
    07-16 12:57:59.190 10641-10700/eu.livotov.labs.android.camview.test D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
    07-16 12:57:59.264 10641-10700/eu.livotov.labs.android.camview.test I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
    07-16 12:57:59.270 10641-10700/eu.livotov.labs.android.camview.test I/OpenGLRenderer: Initialized EGL, version 1.4
    07-16 12:58:00.182 10641-10699/eu.livotov.labs.android.camview.test W/CameraBase: An error occurred while connecting to camera: 0
    07-16 12:58:01.184 10641-10699/eu.livotov.labs.android.camview.test W/CameraBase: An error occurred while connecting to camera: 0
    07-16 12:58:02.185 10641-10699/eu.livotov.labs.android.camview.test W/CameraBase: An error occurred while connecting to camera: 0
    07-16 12:58:02.300 10641-10647/eu.livotov.labs.android.camview.test I/art: Debugger is no longer active
    07-16 12:58:03.186 10641-10699/eu.livotov.labs.android.camview.test W/CameraBase: An error occurred while connecting to camera: 0
    07-16 12:58:04.212 10641-10641/eu.livotov.labs.android.camview.test E/ScannerLiveView: n/a
    07-16 12:58:04.388 10641-10700/eu.livotov.labs.android.camview.test V/RenderScript: 0xaf046000 Launching thread(s), CPUs 4
    
    

    Surely i used the Example App out of the Repository, my Nexus running is no Custom ROM, its up2date and the old library is working.

    Also i tried it with a Samsung its works..

    Would be nice if you could investigate why this it not working :(

    opened by saschaarthur 2
  • getParameters failed (empty parameters)

    getParameters failed (empty parameters)

    Hi,

    sometimes i get the following error. Happened on samsung s6 with android 6.0.1. Happens only once in a while. App is switching scanner on and off again very often.

    java.lang.RuntimeException: getParameters failed (empty parameters)
                                                                       at android.hardware.Camera.native_getParameters(Native Method)
                                                                       at android.hardware.Camera.getParameters(Camera.java:1996)
                                                                       at eu.livotov.labs.android.camview.camera.v1.DefaultCameraV1Controller.rechargePreviewBuffer(DefaultCameraV1Controller.java:169)
                                                                       at eu.livotov.labs.android.camview.camera.v1.DefaultCameraV1Controller.requestLiveData(DefaultCameraV1Controller.java:158)
                                                                       at eu.livotov.labs.android.camview.ScannerLiveView.resumeGrabbing(ScannerLiveView.java:146)
                                                                       at eu.livotov.labs.android.camview.ScannerLiveView.onReceiveProcessedCameraFrame(ScannerLiveView.java:275)
                                                                       at eu.livotov.labs.android.camview.camera.AbstractController$ProcessingResultHandler.handleMessage(AbstractController.java:43)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:158)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:7229)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    

    Thanks !

    opened by anjawahl 4
Releases(v2.0.1)
Owner
Livotov Labs Ltd.
Livotov Labs Ltd.
Android library for creating QR-codes with logo, custom pixel/eyes shapes, background image. Powered by ZXing.

custom-qr-generator Android library for creating QR-codes with logo, custom pixel/eyes shapes, background image. Powerd by ZXing. Installation To get

Alexander Zhirkevich 34 Dec 17, 2022
a simple QRCode generation api for java built on top ZXING

QRGen: a simple QRCode generation api for java built on top ZXING Please consider sponsoring the work on QRGen Dependencies: ZXING: http://code.google

Ken Gullaksen 1.4k Dec 31, 2022
Generate Qr Code using ZXING with a logo if needed

QrGeneratorWithLogo Generate Qr Code using ZXING with a logo if needed Download the Helper file and use it 1- add zxing lib into your project implem

null 0 Mar 14, 2022
Barcode Scanner Libraries for Android

Project Archived July 1 2020 This project is no longer maintained. When I first started this project in late 2013 there were very few libraries to hel

Dushyanth 5.4k Jan 3, 2023
QrX: Camera with ML Kit QR/Barcode detection

QrX: Camera with ML Kit QR/Barcode detection This library allows you to easily add CameraX Preview with attached ML Kit to detect and display Qr codes

Mateusz Lutecki 1 Apr 7, 2022
Android app and Python library for turning mobile phone into a WebSocket-based, remotely controllable Barcode/QR code reader

Remote Barcode Reader suite Android app and Python library for turning mobile phone into a remotely controllable Barcode/QR code reader. It exposes a

Krystian Dużyński 3 Dec 6, 2022
⭐️ Quick and easy QR Code scanning app created using Jetpack Compose. ☘️

QR-Code-Scanner Scan your QR codes easily and quickly. ⭐️ Google Play Store : Screenshots of the app : ?? Libraries Used in The Project : // Jetpa

Nisa Efendioğlu 12 Oct 8, 2022
Qart is Android App that's based on CuteR project. App generate QR code that merge a picture. So the QR code looks more beautiful.

Qart is Android App that's based on CuteR project. App generate QR code that merge a picture. So the QR code looks more beautiful.

scola 1k Dec 16, 2022
A library to help implement barcode scanning

A library to help implement barcode scanning

Brightec 99 Nov 30, 2022
QRAlarm - an Android alarm clock application lets the user turn off alarms by scanning the QR Code.

QRAlarm is an Android alarm clock application that does not only wake You up, but also makes You get up to disable the alarm by scanning the QR Code.

null 39 Jan 8, 2023
Barcode scanner library for Android, based on the ZXing decoder

ZXing Android Embedded Barcode scanning library for Android, using ZXing for decoding. The project is loosely based on the ZXing Android Barcode Scann

JourneyApps 5.3k Jan 4, 2023
Android library for creating QR-codes with logo, custom pixel/eyes shapes, background image. Powered by ZXing.

custom-qr-generator Android library for creating QR-codes with logo, custom pixel/eyes shapes, background image. Powerd by ZXing. Installation To get

Alexander Zhirkevich 34 Dec 17, 2022
Secret Codes is an Open Source application that allows you to browse through hidden codes of your Android phone.

####Secret Codes is an Open Source application that allows you to browse through hidden codes of your Android phone. This application will scan throug

Simon Marquis 251 Jan 6, 2023
D4rK QR & Bar Code Scanner Plus is a FOSS scanner app for every Android. 📷

?? QR & Bar Code Scanner Plus ?? ╔╦╦╦═╦╗╔═╦═╦══╦═╗ ║║║║╩╣╚╣═╣║║║║║╩╣ ╚══╩═╩═╩═╩═╩╩╩╩═╝ D4rK QR & Bar Code Scanner Plus is a FOSS scanner app for every

D4rK 8 Dec 19, 2022
Google Guice on Android, version 3.0 [RETIRED]

As of August 2016, RoboGuice is no longer supported. For nearly 5 years it was the #1 dependency injection framework on Android due to its ease-of-use

null 3.8k Dec 26, 2022
HockeyApp was retired and the SDKs are deprecated. Please use App Center instead.

Version 5.2.0 HockeySDK-Android implements support for using HockeyApp in your Android applications. The following features are currently supported: C

Bit Stadium GmbH 280 Dec 13, 2022
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Project in Maintenance Mode Only The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enha

ZXing Project 30.5k Dec 27, 2022
Camera Folder: "Take a Photo from Camera" everywhere where you can open a photo file

When "Camera Folder" is installed many Android-Apps that can open jpg files can also take a photo from camera.

k3b 18 Dec 20, 2022
a simple QRCode generation api for java built on top ZXING

QRGen: a simple QRCode generation api for java built on top ZXING Please consider sponsoring the work on QRGen Dependencies: ZXING: http://code.google

Ken Gullaksen 1.4k Dec 31, 2022