firebase_messaging not working in android 10 e latter after long period of inactivity of the app in FLUTTER

150 Views Asked by At

firebase_messaging not working in android 10 e latter after long period of inactivity of the app. I configured services in the background, and it works up to version 9 of android. But in later versions it doesn't work, I've tried everything, even implementing native with kotlin believing it could be something with Flutter. I read about the battery saving mode, "DOZE mode"...but nothing solves it...

1

There are 1 best solutions below

0
On

If you are using cloud functions to send push notifications, Go to your .js file and update the priority to high. Or if you are using any other service to send notifications make sure priority should be high in notification data . I faced the same issue screen was not getting wake for my app notifications when device was in doze mode , only "priority":"high" solved my problem.

 return {
    data: data,
  "android":{
  "priority":"high"
},
    apns: {
        headers: {
          "apns-priority":"5"
        },
        payload: {
            aps: {
                alert: {
                    title: title,
                    body: body
                },
                badge: 1,
                sound: sound,
                priority: "high",
                category: clickAction,
            }
        },
    },
    topic: recipientId,
};

}