v2.55.3 — Code-Review-Fixes: foregroundServiceType (Android 14+), POST_NOTIFICATIONS-Check, FG-Service-Notification-Channel, try/catch _zeigeSyncNotification
CRITICAL: - AndroidManifest: foregroundServiceType="dataSync" für BackgroundService (Android 14+ MissingForegroundServiceTypeException) - main.dart: notificationChannelId + initialNotificationTitle + foregroundServiceTypes für FlutterBackgroundService (fehlende FG-Notification → ANR/crash nach 5s) MEDIUM: - sync_service.dart: POST_NOTIFICATIONS-Permission-Check vor _starteForegroundService (Android 13+) - sync_service.dart: try/catch um _zeigeSyncNotification (plugin-dispose-Sicherheit) flutter analyze: clean | flutter test: 194/194 passed
This commit is contained in:
@@ -77,12 +77,33 @@ void main() async {
|
||||
?.createNotificationChannel(syncChannel);
|
||||
|
||||
// ── Background Service initialisieren (Issue #3) ──
|
||||
// v2.55.3: Foreground-Service-Notification-Channel konfigurieren.
|
||||
// Ohne notificationChannelId zeigt der Service eine Default-Notification
|
||||
// ohne eigenen Channel — auf Android 14+ Pflicht.
|
||||
const fgChannel = AndroidNotificationChannel(
|
||||
'de.baka.melo.fg_service',
|
||||
'Melo Hintergrunddienst',
|
||||
description: 'Hält Melo im Hintergrund aktiv (Sync, Downloads)',
|
||||
importance: Importance.low,
|
||||
playSound: false,
|
||||
enableVibration: false,
|
||||
showBadge: false,
|
||||
);
|
||||
await notificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.createNotificationChannel(fgChannel);
|
||||
|
||||
await FlutterBackgroundService().configure(
|
||||
iosConfiguration: IosConfiguration(),
|
||||
androidConfiguration: AndroidConfiguration(
|
||||
onStart: _onServiceStart,
|
||||
autoStart: false,
|
||||
isForegroundMode: true,
|
||||
notificationChannelId: 'de.baka.melo.fg_service',
|
||||
initialNotificationTitle: 'Melo Sync',
|
||||
initialNotificationContent: 'Synchronisiere Musik…',
|
||||
foregroundServiceTypes: [AndroidForegroundType.dataSync],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user