Alarm plugin versionex: 0.2.9 (please update to the latest version before submitting the issue)
3.0.10
Describe the bug
I'm using FCM, and alarm doesn't work when it's being callled from the handler of onBackgroundMessage
To ReproduceSteps to reproduce the behavior:
class FirebaseApi {
final _firebaseMessaging = FirebaseMessaging.instance;
final DatabaseReference dbRef = FirebaseDatabase.instance.ref();
Future<void> initNotification() async {
await _firebaseMessaging.requestPermission();
// check for internet !!!!!!!!!!!!!!!!!!!!!
final fCMToken = await _firebaseMessaging.getToken();
print("Token: $fCMToken");
}
static Future<dynamic> _firebaseMessagingBackgroundHandler(
RemoteMessage message) async {
print("Handling background message");
// await Alert.startAlarm("");
final alarmSettings = AlarmSettings(
id: 42,
dateTime: DateTime.now(),
assetAudioPath: 'assets/alarm.mp3',
loopAudio: true,
vibrate: true,
volume: 0.8,
fadeDuration: 3.0,
notificationTitle: 'This is the title',
notificationBody: 'This is the body',
enableNotificationOnKill: true,
);
await Alarm.set(alarmSettings: alarmSettings);
}
Future initPushNotifications() async {
// handle notif if the app was terminated and now opened
FirebaseMessaging.instance.getInitialMessage().then((value) => null);
// attach event listners for when a notification opens the app
FirebaseMessaging.onMessageOpenedApp
.listen(_firebaseMessagingBackgroundHandler);
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
}
}
Expected behaviorA clear and concise description of what you expected to happen.
ScreenshotsIf applicable, add screenshots to help explain your problem.
Device infoProvide device info (Manufacturer, OS version, ...)Android 9
Additional contextAdd any other context about the problem here.
Alarm plugin version ex: 0.2.9 (please update to the latest version before submitting the issue) 3.0.10 Describe the bug I'm using FCM, and alarm doesn't work when it's being callled from the handler of onBackgroundMessage
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Device info Provide device info (Manufacturer, OS version, ...) Android 9
Additional context Add any other context about the problem here.