E/flutter (9973): [ОШИБКА: flutter/runtime/dart_vm_initializer. cc(41)] Необработанное исключение: PlatformException(exact_alarms_not_permited, Точные сигналы тревоги не разрешены, null, null)
и приложение зависает. Вот код, вызывающий ошибку:
Код: Выделить всё
Future repeatNotification() async {
const AndroidNotificationDetails androidNotificationDetails =
AndroidNotificationDetails(
'repeating channel id', 'repeating channel name',
channelDescription: 'repeating description');
const NotificationDetails notificationDetails =
NotificationDetails(android: androidNotificationDetails);
// Create a list of greetings
List greetings = [
"Hi!",
"Hey there!",
"Hello!",
"Hi there!",
"What's up?",
"Howdy!",
];
// Create a list of daily check-in messages
List checkInMessages = [
"It's time for your daily check in.",
"Don't forget to check in today.",
"Remember to take a moment to check in.",
"How are you doing today?",
"Time for your daily mindfulness moment.",
"Can we chat?",
"Let's talk!",
];
// Create a random number generator
var rng = math.Random();
// Pick a random greeting
String randomGreeting = greetings[rng.nextInt(greetings.length)];
// Pick a random check-in message
String randomCheckInMessage = checkInMessages[rng.nextInt(checkInMessages.length)];
await flutterLocalNotificationsPlugin.periodicallyShow(
id++,
randomGreeting,
randomCheckInMessage,
RepeatInterval.everyMinute,
notificationDetails,
androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
);
}
Подробнее здесь: https://stackoverflow.com/questions/763 ... act-alarms