mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-04 15:49:49 +00:00
fix(android): request notification permission on startup (#1497)
This commit is contained in:
1 file changed
+7
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user