Skip to content

Commit

Permalink
Make Google happy (scheduled alarms require user permission since And…
Browse files Browse the repository at this point in the history
…roid 14)
  • Loading branch information
jenspfahl committed Aug 8, 2024
1 parent f11c723 commit 9bb5e01
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<queries>
<intent>
Expand Down
5 changes: 5 additions & 0 deletions lib/service/LocalNotificationService.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,10 @@ class LocalNotificationService {
actions: actions,
);
}

void requestPermissions() {
AndroidFlutterLocalNotificationsPlugin? nativePlugin = _flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation();
nativePlugin?.requestExactAlarmsPermission();
}
}

1 change: 1 addition & 0 deletions lib/ui/PersonalTaskLoggerScaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class PersonalTaskLoggerScaffoldState extends State<PersonalTaskLoggerScaffold>
DueScheduleCountService().gather();
});

_notificationService.requestPermissions();
}

PageScaffold getSelectedPage() {
Expand Down
2 changes: 2 additions & 0 deletions metadata/en-US/changelogs/10702.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fix Schedule notification bug #79
* (Upgrade target version and dependencies)
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.7.1+10701
version: 1.7.2+10702

environment:
sdk: ">=3.4.0"
Expand Down

0 comments on commit 9bb5e01

Please sign in to comment.