mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-06 08:30:29 +00:00
fix(android): request notification permission on startup
This commit is contained in:
1 parent
1f8906f952
commit
39912718c4
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