Skip to content

cyb3rko/jabcode-android

Repository files navigation

JAB Code

JAB Code Android

API license last commit



About this project

Warning

This library is still in development and not recommended for production use.
I couldn't figure out yet how to pass the image bytes directly to the native library.
The performance is still bad due to a workaround (see Bad Performance (Workaround) for more information).
Help needed!

This library is a Kotlin wrapper around the native JAB Code library implementation (to be found at jabcode/jabcode).
It utilizes the JNI (Java Native Interface) and some lines of custom C code to communicate with the native implementation.

But what's a JAB Code?

JAB Code (Just Another Bar Code) is a high-capacity 2D color bar code, which can encode more data than traditional black/white codes. This repository contains a library for reading and writing JAB codes, along with sample applications. A demo webinterface is available at https://jabcode.org.

If you think it's worth to support this project, feel free to give a small donation ❤️.


  • 🔗 easy to integrate
  • 🏋️‍♂️ lightweight library
  • 📦 wrapper around orignal native code (no modifications) -> easy to update native library

How to use

Create a JabCodeLib object (which initializes the native library behind the scenes).

val jabCodeLib: JabCodeLib = JabCodeLib()

Call the detect(imagePath: String) function with a valid absolute file path of the image you want to scan.

val result: ByteArray? = jabCodeLib.detect(file.absolutePath)

(Short form for single call):

val result: ByteArray? = JabCodeLib().detect(file.absolutePath)

There you have the content of the code, or null if nothing was found.
If you for example saved a string in your JAB Code, you can now read it with

val string = result.decodeToString()

Bad Performance (Workaround)

Unfortunately the current implementation has a very bad performance due to a workaround.
I couldn't figure out yet how to pass the image bytes directly to the native library.
Currently the logic looks like this:

Ideally the implementation could rather look like this for best performance:


Icon Credits

Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com
License - https://fontawesome.com/license/free
Copyright 2024 Fonticons, Inc.

Contribute

Of course, I'm happy about any kind of contribution.

For creating issues there's no real guideline you should follow. If you create pull requests please try to use the syntax I use. Using a unified code format makes it much easier for me and for everyone else.

License

Copyright (C) 2024 Cyb3rKo

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Lesser Public License for more
details.

A copy of the GNU Lesser General Public License can be found alongside this
library's source code. Alternatively, see at <http:https://www.gnu.org/licenses/>.