From 36f9f65384afef6e45b7906dfd9f9f8a31e2b126 Mon Sep 17 00:00:00 2001 From: Levi Date: Thu, 10 Sep 2026 23:05:15 +0800 Subject: [PATCH] fix(android): request notification permission on startup (#1497) --- .../lib/app/application/android_foreground_service.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/flutter/lib/app/application/android_foreground_service.dart b/ui/flutter/lib/app/application/android_foreground_service.dart index 479b7363..9efd4da8 100644 --- a/ui/flutter/lib/app/application/android_foreground_service.dart +++ b/ui/flutter/lib/app/application/android_foreground_service.dart @@ -28,6 +28,13 @@ class AndroidForegroundService { ), ); + // Android 13+ requires runtime permission to show the service notification. + // A denial only hides it from the notification drawer; the service can run. + final permission = await FlutterForegroundTask.checkNotificationPermission(); + if (permission == NotificationPermission.denied) { + await FlutterForegroundTask.requestNotificationPermission(); + } + if (await FlutterForegroundTask.isRunningService) { _throwOnFailure(await FlutterForegroundTask.restartService()); return;