FirebaseMessaging.onBackgroundMessage stops working when switched to different app

Viewed 29

I am using FlutterFire FCM, the onBackgroundMessage method works when the app is in background but when a different app is opened, the method is not invoked. The issue is only on iOS devices.

Future setUpInteractedMessage() async {
 FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
  debugPrint('Got a message whilst in the foreground!');
  debugPrint('Message data: ${message.data}');
 });

 FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
 FirebaseMessaging.onMessageOpenedApp.listen(_handleMessage);
}
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  //This is a separate isolate
  debugPrint("Handling a background message: ${message.messageId}");
}

Here's my payload

{

     "condition": "'channel_prefecture_1' in topics || 'channel_prefecture_8' in topics",
    "notification":{
      "title":"Test Title",
      "body":"Testing 101"
    },
    "data" : {
     "type": "GENERAL"
    },
    "content_available": true,
    "priority": "high"
}
0 Answers
Related