Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Issues with Firebase Messaging when app is terminated #1353

Open
3 of 8 tasks
michaelnabil230 opened this issue Oct 9, 2023 · 2 comments
Open
3 of 8 tasks
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. type: bug Something isn't working

Comments

@michaelnabil230
Copy link

michaelnabil230 commented Oct 9, 2023

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Linux
  • macOS
  • Web
  • Windows

I am encountering issues when using the firebase_messaging and geolocator plugins in a Flutter app. Specifically, the problem arises when I try to use the getPositionStream method from the geolocator plugin while the app is terminated.

The error messages I am encountering in the terminal are as follows:

  1. "Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter.baseflow.com/geolocator_updates_android. Response ID: 16"

These errors seem to be related to the interaction between the geolocator plugin and the firebase_messaging plugin when the app is in a terminated state. This issue does not occur when the app is in the foreground or background.

Steps to reproduce

  1. Clone the example code from the provided GitHub repository.
  2. Run the app.
  3. Terminate the app (e.g., swipe it away from the recent apps list).
  4. Observe the error messages in the terminal.

Expected results

The geolocator plugin should work as expected, even when the app is terminated. It should not produce the mentioned error messages.

Actual results

The error messages mentioned above are displayed in the terminal when using the geolocator plugin in combination with the firebase_messaging plugin while the app is terminated.

Code sample

Can clone the app to test the issue Link in Github

Version

10.1.0

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64, locale
    en-EG)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.83.0)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
@JeroenWeener
Copy link
Contributor

Thank you for reaching out @michaelnabil230. Appreciate the example app! Just a heads-up that it contains API keys that you might want to keep hidden.

Seems like we are holding onto old method channel instances. A quick search yields the following StackOverflow page: https://stackoverflow.com/questions/61934900/tried-to-send-a-platform-message-to-flutter-but-flutterjni-was-detached-from-n.

This will require further investigation. I will add it to our list.

We want to stimulate the community to contribute to the plugins. If you are able to dig into the issue yourself, you are free to open a PR yourself. We will gladly assist you.

@JeroenWeener JeroenWeener added type: bug Something isn't working platform: android Issue is related to the Android platform. P2 Important issues not at the top of the work list. labels Oct 10, 2023
@michaelnabil230
Copy link
Author

Hi @JeroenWeener @mvanbeusekom

Any news on fixing this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants