Skip to content
Init is here / May 19 - 23
Back

Firebase Messaging Causes ANR on Notification Receive in Flutter App (Even with Minimal Handler)

  • 0
  • Android
  • Flutter
  • Messaging
IKINDU
23 May, 2025, 11:50

I am working on a Flutter project where I have set up notifications using Firebase Messaging. Everything was working perfectly until recently. After coming back to the project after a long time and running the code again, the app crashes with an ANR (Application Not Responding) when a notification is received.

The notification is received, and the foreground handler gets the data, but then the app crashes immediately.

After debugging, I realized that once the notification is received, something takes a long time to process, which is likely causing the crash.

To investigate further, I removed all heavy tasks and left only a simple print log inside the handler—but the crash still occurs.

https://stackoverflow.com/questions/79596466/firebase-messaging-causes-anr-on-notification-receive-in-flutter-app-even-with

TL;DR
Issue: Flutter app experiencing ANR when receiving notifications through Firebase Messaging. Solution: The ANR might be due to a delay in processing notifications. Try optimizing the code further and reducing processing time. Even with minimal code in the message handler, the crash persists. This indicates a deeper issue with the notification processing mechanism. Further debugging and profiling of the notification handling logic are required to pinpoint and resolve the cause of the ANR.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more