alpha
Login
or
Join now
kasper.space
/
notifier
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
[READ-ONLY] Mirror of https://github.com/probablykasper/notifier. Android app for scheduling notifications
android
app
flutter
notifications
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Add android_alarm_manager_plus
author
Kasper
date
4 years ago
(May 31, 2022, 12:33 AM +0200)
commit
55a7b94e
55a7b94e9ab6f54f054ed825bb3ad34372420022
parent
c6caf1e6
c6caf1e6d33f11c7ea9e60de37cd9b49664946a5
+57
-23
6 changed files
Expand all
Collapse all
Unified
Split
android
app
src
main
AndroidManifest.xml
lib
list_page.dart
main.dart
scheduler.dart
pubspec.lock
pubspec.yaml
+9
-11
android/app/src/main/AndroidManifest.xml
View file
Reviewed
···
1
1
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
2
package="com.example.notifier">
3
3
4
4
-
<!-- For android_alarm_manager_plus -->
5
5
-
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
6
6
-
<!-- For android_alarm_manager_plus -->
7
7
-
<uses-permission android:name="android.permission.WAKE_LOCK"/>
8
8
-
<!-- For android_alarm_manager_plus -->
4
4
+
<!-- Start Alarm Manager -->
9
5
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
6
6
+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
7
7
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
8
8
+
<!-- End Alarm Manager -->
10
9
11
10
<application
12
11
android:label="notifier"
···
39
38
android:name="flutterEmbedding"
40
39
android:value="2" />
41
40
42
42
-
<!-- For android_alarm_manager_plus -->
41
41
+
<!-- Start Alarm Manager -->
43
42
<service
44
43
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService"
45
45
-
android:permission="android.permission.BIND_JOB_SERVICE"
46
46
-
android:exported="false"/>
47
47
-
<!-- For android_alarm_manager_plus -->
44
44
+
android:exported="false"
45
45
+
android:permission="android.permission.BIND_JOB_SERVICE" />
48
46
<receiver
49
47
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver"
50
50
-
android:exported="false"/>
51
51
-
<!-- For android_alarm_manager_plus -->
48
48
+
android:exported="false" />
52
49
<receiver
53
50
android:name="dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver"
54
51
android:enabled="false"
···
57
54
<action android:name="android.intent.action.BOOT_COMPLETED" />
58
55
</intent-filter>
59
56
</receiver>
57
57
+
<!-- End Alarm Manager -->
60
58
61
59
</application>
62
60
</manifest>
+3
lib/list_page.dart
View file
Reviewed
···
30
30
Widget;
31
31
import 'package:get/state_manager.dart';
32
32
import 'package:notifier/edit_dialog.dart';
33
33
+
import 'package:notifier/scheduler.dart';
33
34
import 'notification_item.dart' show NotificationItem;
34
35
import 'theme.dart' show CustomTheme, toggleDarkMode;
35
36
···
52
53
editMode: false,
53
54
onSave: (item) {
54
55
c.items.add(item);
56
56
+
scheduleNotifications();
55
57
},
56
58
));
57
59
}),
···
112
114
editMode: true,
113
115
onSave: (item) {
114
116
c.items[index] = item;
117
117
+
scheduleNotifications();
115
118
},
116
119
));
117
120
},
+19
-12
lib/main.dart
View file
Reviewed
···
1
1
+
import 'dart:isolate';
2
2
+
1
3
import 'package:flutter/material.dart' show ThemeMode, runApp;
2
2
-
// import 'package:notifier/notification_items.dart' show scheduleNotifications;
4
4
+
import 'package:notifier/scheduler.dart' show scheduleNotifications;
3
5
import 'theme.dart' show getTheme, initializeTheme;
4
6
import 'list_page.dart' show ListPage;
5
7
import 'package:shared_preferences/shared_preferences.dart'
6
8
show SharedPreferences;
7
9
import 'package:get/get.dart' show GetMaterialApp;
8
8
-
// import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart'
9
9
-
// show AndroidAlarmManager;
10
10
+
import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart';
10
11
11
12
var prefsFuture = SharedPreferences.getInstance();
12
13
14
14
+
void printHello() {
15
15
+
final DateTime now = DateTime.now();
16
16
+
final int isolateId = Isolate.current.hashCode;
17
17
+
print("[$now] Hello, world! isolate=$isolateId");
18
18
+
}
19
19
+
13
20
void main() async {
14
21
// Be sure to add this line if AndroidAlarmManager.initialize() call happens before runApp()
15
22
// WidgetsFlutterBinding.ensureInitialized();
16
23
17
17
-
// await AndroidAlarmManager.initialize();
18
18
-
19
24
runApp(
20
25
GetMaterialApp(
21
21
-
title: 'Notifier',
22
22
-
// debugShowCheckedModeBanner: false,
23
23
-
theme: getTheme(false),
24
24
-
darkTheme: getTheme(true),
25
25
-
themeMode: ThemeMode.system,
26
26
-
home: ListPage()),
26
26
+
title: 'Notifier',
27
27
+
debugShowCheckedModeBanner: false,
28
28
+
theme: getTheme(false),
29
29
+
darkTheme: getTheme(true),
30
30
+
themeMode: ThemeMode.system,
31
31
+
home: ListPage(),
32
32
+
),
27
33
);
28
34
initializeTheme();
29
35
30
30
-
// scheduleNotifications();
36
36
+
await AndroidAlarmManager.initialize();
37
37
+
scheduleNotifications();
31
38
}
+18
lib/scheduler.dart
View file
Reviewed
···
1
1
+
import 'dart:isolate' show Isolate;
2
2
+
import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart'
3
3
+
show AndroidAlarmManager;
4
4
+
5
5
+
const mainAlarmId = 0;
6
6
+
7
7
+
void scheduleNotifications() async {
8
8
+
handler();
9
9
+
await AndroidAlarmManager.periodic(
10
10
+
const Duration(minutes: 1), mainAlarmId, handler,
11
11
+
rescheduleOnReboot: true);
12
12
+
}
13
13
+
14
14
+
void handler() async {
15
15
+
final DateTime now = DateTime.now();
16
16
+
final int isolateId = Isolate.current.hashCode;
17
17
+
print("[$now] Hello, world! isolate=$isolateId");
18
18
+
}
+7
pubspec.lock
View file
Reviewed
···
1
1
# Generated by pub
2
2
# See https://dart.dev/tools/pub/glossary#lockfile
3
3
packages:
4
4
+
android_alarm_manager_plus:
5
5
+
dependency: "direct main"
6
6
+
description:
7
7
+
name: android_alarm_manager_plus
8
8
+
url: "https://pub.dartlang.org"
9
9
+
source: hosted
10
10
+
version: "2.0.5"
4
11
async:
5
12
dependency: transitive
6
13
description:
+1
pubspec.yaml
View file
Reviewed
···
38
38
get: ^4.6.5
39
39
awesome_notifications: ^0.6.21
40
40
intl: ^0.17.0
41
41
+
android_alarm_manager_plus: ^2.0.5
41
42
42
43
dev_dependencies:
43
44
flutter_test: