-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22e4f71
commit 551b1d7
Showing
18 changed files
with
141 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:alarm/alarm.dart'; | ||
import 'package:permission_handler/permission_handler.dart'; | ||
|
||
class AlarmPermissions { | ||
static Future<void> checkAndroidNotificationPermission() async { | ||
final status = await Permission.notification.status; | ||
if (status.isDenied) { | ||
alarmPrint('Requesting notification permission...'); | ||
final res = await Permission.notification.request(); | ||
alarmPrint( | ||
'Notification permission ${res.isGranted ? '' : 'not '}granted', | ||
); | ||
} | ||
} | ||
|
||
static Future<void> checkAndroidExternalStoragePermission() async { | ||
final status = await Permission.storage.status; | ||
if (status.isDenied) { | ||
alarmPrint('Requesting external storage permission...'); | ||
final res = await Permission.storage.request(); | ||
alarmPrint( | ||
'External storage permission ${res.isGranted ? '' : 'not'} granted', | ||
); | ||
} | ||
} | ||
|
||
static Future<void> checkAndroidScheduleExactAlarmPermission() async { | ||
final status = await Permission.scheduleExactAlarm.status; | ||
alarmPrint('Schedule exact alarm permission: $status.'); | ||
if (status.isDenied) { | ||
alarmPrint('Requesting schedule exact alarm permission...'); | ||
final res = await Permission.scheduleExactAlarm.request(); | ||
alarmPrint( | ||
'Schedule exact alarm permission ${res.isGranted ? '' : 'not'} granted', | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.