Kafiul Islam
Kafiul Islam

Reputation: 124

How to implement schedule background notification in flutter?

I am building a health related Flutter app. Where I would like to send a reminder notification about his/her workout everyday in a specific time. If the app is terminated but notification must work in background.

Could anyone please help me sharing any reliable video/written source to implement this feature in my app? Thanks in advance.

Upvotes: 0

Views: 33

Answers (1)

Use Flutter Local Notifications library - https://pub.dev/packages/flutter_local_notifications#periodically-show-a-notification-with-a-specified-interval

Periodically show a notification with a specified interval:

const AndroidNotificationDetails androidNotificationDetails =
AndroidNotificationDetails(
    'repeating channel id', 'repeating channel name',
    channelDescription: 'repeating description');
const NotificationDetails notificationDetails =
NotificationDetails(android: androidNotificationDetails);
await flutterLocalNotificationsPlugin.periodicallyShow(0, 'repeating title',
'repeating body', RepeatInterval.everyMinute, notificationDetails,
androidAllowWhileIdle: true);

Upvotes: 0

Related Questions