https://github.com/cyb3rko/jabcode-android
Android library for reading JAB codes
https://github.com/cyb3rko/jabcode-android
android android-app android-application android-library jabcode kotlin library
Last synced: about 1 year ago
JSON representation
Android library for reading JAB codes
- Host: GitHub
- URL: https://github.com/cyb3rko/jabcode-android
- Owner: cyb3rko
- License: lgpl-2.1
- Created: 2024-01-27T00:46:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-21T21:31:48.000Z (over 2 years ago)
- Last Synced: 2025-04-14T01:52:48.508Z (about 1 year ago)
- Topics: android, android-app, android-application, android-library, jabcode, kotlin, library
- Language: Kotlin
- Homepage: https://jabcode.org
- Size: 4.5 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JAB Code Android
[](https://apilevels.com)
[](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
[](https://github.com/cyb3rko/jabcode-android/commits/main)
---
- [About this project](#about-this-project)
- [How to use](#how-to-use)
- [Bad Performance (Workaround)](#bad-performance-workaround)
- [Contribute](#contribute)
- [License](#license)
---
## 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)](#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](https://github.com/jabcode/jabcode)).
It utilizes the [JNI (Java Native Interface)](https://de.wikipedia.org/wiki/Java_Native_Interface) and [some lines of custom C code](https://github.com/search?q=repo%3Acyb3rko%2Fjabcode-android++language%3AC&type=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 :heart:.
---
- 🔗 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).
```kotlin
val jabCodeLib: JabCodeLib = JabCodeLib()
```
Call the `detect(imagePath: String)` function with a valid absolute file path of the image you want to scan.
```kotlin
val result: ByteArray? = jabCodeLib.detect(file.absolutePath)
```
(Short form for single call):
```kotlin
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
```kotlin
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](https://github.com/cyb3rko/jabcode-android/issues) there's no real guideline you should follow.
If you create [pull requests](https://github.com/cyb3rko/jabcode-android/pulls) 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 .