dolibarr.handybarcodescanner/android-app/BrotherPrintHelper/README.md
data 8586b568e8 v8.1: Quagga2 Scanner Fix, Brother Android App, Bestelllogik-Update
## Quagga2 Scanner
- Reader-Reihenfolge optimiert: CODE128/CODE39 vor EAN
- Verhindert Fehlerkennungen bei alphanumerischen Codes (z.B. P20260030)
- EAN-Reader haben niedrigere Priorität

## Brother PT-E560BT Android App
- Native Kotlin App für Bluetooth-Druck auf Brother PT-E560BT
- Intent-Schema: brotherprint://print?barcode=XXX&ref=REF
- 90° Rotation für Längs-Druck auf 24mm TZe-Band
- Produkt-Referenz (fett), Barcode-Strichen, Barcode-Wert
- Erweiterte Error-Handling (SetLabelsizeError, NoCoverError, etc.)
- Build: Gradle 9.3.1, Kotlin 2.1.0, Brother SDK v4

## Bestelllogik
- ref_supplier = "Direkt" (ohne Datum) für dauerhafte Direktbestellungen
- Pro Lieferant eine durchgängige Direkt-Bestellung statt tägliche neue

## PWA Updates
- Service Worker v8.1
- CSS/JS Cache-Invalidierung (?v=81)
- localStorage Migration für alte Keys

## Dokumentation
- README.md aktualisiert mit Brother-App und PWA-Details
- Dateistruktur erweitert um android-app/
- .gitignore für Test-Dateien

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-07 18:24:10 +01:00

3.6 KiB
Executable file

BrotherPrintHelper - Native Android App

Native Android App zum Drucken von Barcodes auf Brother P-touch E560BT über Bluetooth.

Projekt-Setup

1. Android Studio Projekt erstellen

  1. Android Studio öffnen
  2. New ProjectEmpty Activity
  3. Einstellungen:
    • Name: BrotherPrintHelper
    • Package name: de.data_it_solution.brotherprinthelper
    • Save location: Beliebig
    • Language: Kotlin
    • Minimum SDK: API 24 (Android 7.0) oder höher
    • Build configuration language: Kotlin DSL (build.gradle.kts)

2. Brother SDK herunterladen

  1. Brother Developer Portal: https://developerprogram.brother-usa.com/sdk-download
  2. Android Mobile SDK herunterladen (neueste Version)
  3. SDK entpacken

3. Brother SDK integrieren

Option A: AAR-Datei (empfohlen):

  1. SDK-AAR-Datei in app/libs/ kopieren
  2. In app/build.gradle.kts einfügen:
dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))
    // ... andere dependencies
}

Option B: Maven (falls verfügbar):

dependencies {
    implementation("com.brother.sdk:brotherprintsdk:4.+")
}

4. Dateien aus diesem Verzeichnis übernehmen

Kopiere folgende Dateien in dein Android Studio Projekt:

  • AndroidManifest.xmlapp/src/main/AndroidManifest.xml (merge mit bestehendem)
  • MainActivity.ktapp/src/main/java/de/data_it_solution/brotherprinthelper/MainActivity.kt
  • build.gradle.ktsapp/build.gradle.kts (merge Dependencies)

5. Projekt kompilieren

./gradlew assembleDebug

6. APK installieren

Über USB:

adb install app/build/outputs/apk/debug/app-debug.apk

Über Android Studio:

  • Run → Run 'app'

Verwendung

Von HandyBarcodeScanner PWA aufrufen

// In scanner.js oder barcode_print.js
function openBrotherPrintApp(barcodeValue) {
    const intent = `intent://print?barcode=${encodeURIComponent(barcodeValue)}#Intent;` +
                   `scheme=brotherprint;` +
                   `package=de.data_it_solution.brotherprinthelper;` +
                   `end`;

    window.location.href = intent;
}

// Beispiel-Aufruf
openBrotherPrintApp('1234567890');

Workflow

  1. User scannt Barcode in HandyBarcodeScanner PWA
  2. PWA ruft openBrotherPrintApp() auf
  3. BrotherPrintHelper App öffnet sich
  4. App verbindet sich mit Brother P-touch E560BT
  5. Druckt Barcode auf 24mm Label
  6. Kehrt automatisch zur PWA zurück

Drucker-Konfiguration

Die App ist vorkonfiguriert für:

  • Drucker: Brother P-touch E560BT
  • Label-Breite: 24mm
  • Barcode-Format: CODE128
  • Verbindung: Bluetooth

Anpassungen in MainActivity.kt:

val labelSize = QLPrintSettings.LabelSize.W24
val printerModel = QL_820NWB // Ggf. anpassen

Troubleshooting

App startet nicht

  • Bluetooth-Permissions in AndroidManifest.xml vorhanden?
  • Brother SDK korrekt in libs/ integriert?

Drucker nicht gefunden

  • Drucker in Android Bluetooth-Settings gepaart?
  • Drucker eingeschaltet und in Reichweite?
  • Brother SDK unterstützt dieses Modell?

Druck schlägt fehl

  • Label eingelegt? (24mm Breite)
  • Drucker-Status OK? (keine Fehler-LED)
  • Template-ID korrekt?

Entwickler-Info

Autor: Eduard Wisch (data@data-it-solution.de) Lizenz: Proprietär Version: 1.0.0 Brother SDK Version: 4.x Min Android: API 24 (Android 7.0) Target Android: API 34 (Android 14)