Files
SAIpp/README.md
T

2.8 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.
  • Visual Overlay: Centered scanning guide with a red line to help align barcodes.
  • ML Kit Integration: High-performance barcode detection (HD 720p analysis).
  • Confirmation Flow: Scanned results are shown in a popup dialog before saving.
  • 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.

📱 User Interface

The app features a professional scanning interface:

  1. Scanner Guide: A white square frame indicates the target area.
  2. Detection Feedback: Once a code is read, a popup dialog appears showing the value.
  3. Database Actions: Users can choose to "Guardar" (Save) to the database or "Cerrar" (Dismiss) to scan again.

⚙️ 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 high-resolution frame capture.
  • ML Kit Barcode Scanning: For processing all barcode formats.
  • 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.