mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
android 13+ request notification permission when start service (#7941)
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -322,6 +322,20 @@ class ServerModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> checkRequestNotificationPermission() async {
|
||||
debugPrint("androidVersion $androidVersion");
|
||||
if (androidVersion < 33) {
|
||||
return true;
|
||||
}
|
||||
if (await AndroidPermissionManager.check(kAndroid13Notification)) {
|
||||
debugPrint("notification permission already granted");
|
||||
return true;
|
||||
}
|
||||
var res = await AndroidPermissionManager.request(kAndroid13Notification);
|
||||
debugPrint("notification permission request result: $res");
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Toggle the screen sharing service.
|
||||
toggleService() async {
|
||||
if (_isStart) {
|
||||
@@ -348,6 +362,7 @@ class ServerModel with ChangeNotifier {
|
||||
stopService();
|
||||
}
|
||||
} else {
|
||||
await checkRequestNotificationPermission();
|
||||
final res = await parent.target?.dialogManager
|
||||
.show<bool>((setState, close, context) {
|
||||
submit() => close(true);
|
||||
|
||||
Reference in New Issue
Block a user