Añadir la lectura de codigo de barras
This commit is contained in:
@@ -5,25 +5,28 @@ Android application developed in Kotlin using Jetpack Compose that scans barcode
|
||||
## 🚀 Features
|
||||
|
||||
- **Instant Scan**: The camera opens automatically upon application startup.
|
||||
- **Connection Status**: Real-time indicator at the top showing if the app can reach the MariaDB server.
|
||||
- **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.
|
||||
- **Localization**: All app strings are managed in `strings.xml` for easy translation.
|
||||
- **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.
|
||||
- MariaDB Server accessible from the mobile device network on port 3306.
|
||||
- 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.
|
||||
1. **Connection Bar**: A status pill at the top (Green: Connected, Red: Error, Gray: Checking).
|
||||
2. **Scanner Guide**: A white square frame indicates the target area with a red alignment line.
|
||||
3. **Detection Popup**: When a code is read, a dialog appears with the value.
|
||||
4. **Database Actions**: Buttons to "Guardar" (Save) or "Cerrar" (Dismiss).
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
@@ -42,18 +45,22 @@ CREATE TABLE scans (
|
||||
Update your database connection details in:
|
||||
`app/src/main/java/com/example/saipp/data/MariaDbConnection.kt`
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Use the raw domain or IP for the `HOST`. **Do NOT include `https://`**.
|
||||
|
||||
```kotlin
|
||||
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"
|
||||
private const val HOST = "mariadb.peta9.com" // Example: "192.168.1.50"
|
||||
private const val PORT = "3306"
|
||||
private const val DATABASE = "sais_db"
|
||||
private const val USER = "sais_dba"
|
||||
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:
|
||||
- Ensure the MariaDB port (default **3306**) is open.
|
||||
- Your MariaDB user must allow remote connections:
|
||||
```sql
|
||||
GRANT ALL PRIVILEGES ON YOUR_DB_NAME.* TO 'YOUR_USER'@'%' IDENTIFIED BY 'YOUR_PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON sais_db.* TO 'sais_dba'@'%' IDENTIFIED BY 'your_password';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
@@ -62,12 +69,12 @@ private const val PASSWORD = "YOUR_PASSWORD"
|
||||
- **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.
|
||||
- **Coroutines**: For asynchronous database and connection checks.
|
||||
|
||||
## ⚠️ 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.
|
||||
> This project uses a **direct JDBC connection**. This is suitable for personal projects or internal tools, but is **not recommended for production apps** as it requires storing credentials in the code and exposing database ports.
|
||||
|
||||
## 📄 License
|
||||
This project is for educational/personal use.
|
||||
|
||||
Reference in New Issue
Block a user