2.2 KiB
2.2 KiB
SAIpp - Barcode Scanner & MariaDB Connector
Android application developed in Kotlin using Jetpack Compose that scans barcodes and saves them directly to a self-hosted MariaDB database.
🚀 Features
- Instant Scan: The camera opens automatically upon application startup.
- ML Kit Integration: High-performance barcode detection using Google ML Kit.
- MariaDB Connectivity: Direct connection to a remote database via JDBC.
- Modern UI: Built with Jetpack Compose and Material 3.
- Permission Handling: Automatic runtime camera permission requests.
🛠️ Requirements
- Android device with API 34+ (Android 14+).
- MariaDB Server accessible from the mobile device network.
- Camera hardware.
⚙️ Configuration
1. Database Setup
Ensure your MariaDB database has a table named scans. You can use the following SQL:
CREATE TABLE scans (
id INT AUTO_INCREMENT PRIMARY KEY,
barcode VARCHAR(255) NOT NULL,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
);
2. App Credentials
Update your database connection details in:
app/src/main/java/com/example/saipp/data/MariaDbConnection.kt
private const val HOST = "YOUR_SERVER_IP"
private const val DATABASE = "YOUR_DB_NAME"
private const val USER = "YOUR_USER"
private const val PASSWORD = "YOUR_PASSWORD"
3. Network Access
- Ensure the MariaDB port (default 3306) is open in your firewall.
- Your MariaDB user must be allowed to connect from remote IPs:
GRANT ALL PRIVILEGES ON YOUR_DB_NAME.* TO 'YOUR_USER'@'%' IDENTIFIED BY 'YOUR_PASSWORD'; FLUSH PRIVILEGES;
📦 Dependencies
- CameraX: For camera preview and frame capture.
- ML Kit Barcode Scanning: For processing barcodes.
- MariaDB Java Client: JDBC driver for database communication.
- Coroutines: For asynchronous database operations.
⚠️ Security Warning
Caution
This project uses a direct JDBC connection from the mobile app to a remote database. This is suitable for personal projects or internal tools, but is not recommended for production apps exposed to the public, as it requires storing database credentials in the code and exposing database ports to the internet.
📄 License
This project is for educational/personal use.