Compare commits
2
Commits
9ac5fdd4f6
...
3d89661b37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d89661b37 | ||
|
|
6de5fbe991 |
No files matched your search
@@ -37,6 +37,21 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
|
||||||
|
android:enabled="true" />
|
||||||
|
<receiver
|
||||||
|
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
|
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||||
|
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
<!-- Required to query activities that can process text, see:
|
<!-- Required to query activities that can process text, see:
|
||||||
https://developer.android.com/training/package-visibility and
|
https://developer.android.com/training/package-visibility and
|
||||||
|
|||||||
+15
-2
@@ -173,7 +173,15 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
Timer? _alarmTimer;
|
Timer? _alarmTimer;
|
||||||
|
|
||||||
Future<void> _scheduleAlarm() async {
|
Future<void> _scheduleAlarm() async {
|
||||||
// Ensure that Android has the correct permissions enabled.
|
// Get the Notifications permission:
|
||||||
|
final android =
|
||||||
|
_notifications
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin
|
||||||
|
>();
|
||||||
|
await android?.requestNotificationsPermission();
|
||||||
|
|
||||||
|
// Ensure that Android has the correct alarm permissions.
|
||||||
final canSchedule = await android?.canScheduleExactNotifications();
|
final canSchedule = await android?.canScheduleExactNotifications();
|
||||||
if (canSchedule != true) {
|
if (canSchedule != true) {
|
||||||
_showSnack('Permissions not yet granted, requesting...');
|
_showSnack('Permissions not yet granted, requesting...');
|
||||||
@@ -243,7 +251,12 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
uiLocalNotificationDateInterpretation:
|
uiLocalNotificationDateInterpretation:
|
||||||
UILocalNotificationDateInterpretation.absoluteTime,
|
UILocalNotificationDateInterpretation.absoluteTime,
|
||||||
);
|
);
|
||||||
_showSnack('Alarm scheduled.');
|
_showSnack('Alarm scheduled!');
|
||||||
|
debugPrint('DEBUG: Alarm time: ${tzAlarm.toString()}');
|
||||||
|
debugPrint('DEBUG: Current time: ${DateTime.now().toUtc().toString()}');
|
||||||
|
debugPrint('DEBUG: ${_notifications.toString()}');
|
||||||
|
|
||||||
|
debugPrint('alarm: $tzAlarm, now: ${tz.TZDateTime.now(tz.local)}');
|
||||||
} else {
|
} else {
|
||||||
_showSnack('Platform not detected, unsure how to show alarm.');
|
_showSnack('Platform not detected, unsure how to show alarm.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user