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

🐛 [firebase_messaging] setting onBackgroundMessage handler breaks plugin platform channel message sending from Android #9689

Closed
umbrellait-timur-khismatullin opened this issue Oct 7, 2022 · 30 comments
Assignees
Labels
platform: android Issues / PRs which are specifically for Android. plugin: messaging resolution: invalid This doesn't seem right and might not belong here. type: bug Something isn't working

Comments

@umbrellait-timur-khismatullin

Bug report

If onBackgroundMessage handler is set, functionality of all other plugins will be broken. This affects sending messages from Android to Flutter.

Steps to reproduce

Steps to reproduce the behavior:

  1. Clone the project with the test_plugin inside
  2. Run the project on Android, wait 3 seconds and make sure that the TestPlugin().onMessageFromNative is not called
  3. Comment 12th line in main method (FirebaseMessaging.onBackgroundMessage) and rerun
  4. After 3 second message from Android will be received

Sample project

https://github.com/umbrellait-timur-khismatullin/on_background_message


Additional context

Probably it's the Flutter bug, similar issue: flutter/flutter#23904
Probably there is also a problem with the implementation of firebase_messaging plugin on the Android side :
https://github.com/firebase/flutterfire/blob/master/packages/firebase_messaging/firebase_messaging/android/src/main/java/io/flutter/plugins/firebase/messaging/FlutterFirebaseMessagingBackgroundExecutor.java#L141


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
[✓] Flutter (Channel stable, 3.3.4, on macOS 11.6 20G165 darwin-x64, locale ru-RU)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Android Studio (version 2020.3)
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
[✓] VS Code (version 1.70.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!


Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 2.18.2
Flutter SDK 3.3.4
on_background_message 1.0.0+1

dependencies:
- firebase_messaging 13.1.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- test_plugin 0.0.1 [flutter plugin_platform_interface]

dev dependencies:
- flutter_lints 2.0.1 [lints]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]

transitive dependencies:
- _flutterfire_internals 1.0.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.9.0 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- characters 1.2.1
- clock 1.1.1
- cloud_firestore_platform_interface 5.7.7 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.8.10 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
- collection 1.16.0
- fake_async 1.3.1 [clock collection]
- firebase_core 1.24.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_platform_interface 4.5.1 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 1.7.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 4.2.0 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.2.0 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- js 0.6.4
- lints 2.0.0
- matcher 0.12.12 [stack_trace]
- material_color_utilities 0.1.5
- meta 1.8.0
- path 1.8.2
- plugin_platform_interface 2.1.3 [meta]
- sky_engine 0.0.99
- source_span 1.9.0 [collection path term_glyph]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.1 [source_span]
- term_glyph 1.2.1
- test_api 0.4.12 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- vector_math 2.1.2

@umbrellait-timur-khismatullin umbrellait-timur-khismatullin added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 7, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label Oct 7, 2022
@darshankawar
Copy link

Thank for the detailed report @umbrellait-timur-khismatullin
Can you please provide any error log that is triggered while doing so ?
Also, please check if your use case is similar / related to #5551

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Oct 7, 2022
@umbrellait-timur-khismatullin
Copy link
Author

@darshankawar hello,
if you run application in debug mode, you can make sure that the plugin method is called. But in the plugin on Flutter side callback doesn't invoked. And at the same time, there are no errors in the log at all, unlike #5551, Android part is sure that the call has been successful.

Log with FirebaseMessaging.onBackgroundMessage
Running "flutter pub get" in on_background_message...
Launching lib/main.dart on Pixel 5 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Debug service listening on ws://127.0.0.1:61147/HmWRoDQd8Y0=/ws
Syncing files to device Pixel 5...
W/FlutterJNI(24718): FlutterJNI.loadLibrary called more than once
I/ResourceExtractor(24718): Found extracted resources res_timestamp-1-1665138368598
W/FlutterJNI(24718): FlutterJNI.prefetchDefaultFontManager called more than once
W/FlutterJNI(24718): FlutterJNI.init called more than once
I/flutter (24718): Android 13
I/FLTFireBGExecutor(24718): Creating background FlutterEngine instance, with args: [--start-paused, --enable-dart-profiling]
E/SurfaceSyncer(24718): Failed to find sync for id=0
W/Parcel  (24718): Expecting binder but got null!
I/FLTFireMsgService(24718): FlutterFirebaseMessagingBackgroundService started!

Without
Launching lib/main.dart on Pixel 5 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Debug service listening on ws://127.0.0.1:63251/l0xC1wR9AnU=/ws
Syncing files to device Pixel 5...
I/flutter (25420): Android 13
E/SurfaceSyncer(25420): Failed to find sync for id=0
W/Parcel  (25420): Expecting binder but got null!
I/flutter (25420): message from Android

Probably these lines from the log will give additional information:

W/FlutterJNI(24718): FlutterJNI.loadLibrary called more than once I/ResourceExtractor(24718): Found extracted resources res_timestamp-1-1665138368598 W/FlutterJNI(24718): FlutterJNI.prefetchDefaultFontManager called more than once W/FlutterJNI(24718): FlutterJNI.init called more than once

I think this is a different problem from the #5551

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Oct 7, 2022
@darshankawar
Copy link

darshankawar commented Oct 7, 2022

Thanks for the update. Based on the details shared and the behavior being replicable using sample project shared, I am keeping this issue open for further insights from the team on expected behavior in the use case described.

/cc @russellwheatley

@darshankawar darshankawar added plugin: messaging platform: android Issues / PRs which are specifically for Android. and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Oct 7, 2022
@ViniciusSossela
Copy link

@darshankawar @russellwheatley

On Android either Background (Minimized) or Terminated (Closed) notifications are not working;
Foreground messages on Android is OK.

in DEBUG mode all works, when we deploy, Background and Terminated doesn't work...
Already tried top-level anonymous Functions and also named functions...

@darshankawar
Copy link

in DEBUG mode all works, when we deploy, Background and Terminated doesn't work...
Already tried top-level anonymous Functions and also named functions...

@ViniciusSossela You are probably hitting #9446 which has been fixed and solution is as mentioned here: #9446 (comment)

@ViniciusSossela
Copy link

in DEBUG mode all works, when we deploy, Background and Terminated doesn't work...
Already tried top-level anonymous Functions and also named functions...

@ViniciusSossela You are probably hitting #9446 which has been fixed and solution is as mentioned here: #9446 (comment)

Thanks @darshankawar .
You were right #9446 (comment) solved the problem.

This issue should be released. Still didn't found the proposed solution in the docs:
https://firebase.google.com/docs/cloud-messaging/flutter/receive
https://firebase.flutter.dev/docs/messaging/usage

Thanks

@russellwheatley
Copy link
Member

Hey @kevinthecheung, it might be worth releasing a new version of the documentation at some point so users have the latest information for the above noted issue. Thanks.

@kevinthecheung
Copy link
Collaborator

@russellwheatley Sure thing, done.

@umbrellait-timur-khismatullin
Copy link
Author

I'm working on mindbox plugin. Some users also use firebase_messaging for their own purposes. But, as I said above, setting onBackgroundMessage violate functionality of the plugin on Android. I added brach with the mindbox plugin to the sample project. On the commit #40f10c61 plugin method pushClicked is called on the Android side, but will never come to the handler on the Flutter side.

After the investigation, I can say that it looks like the plugin is being recreated when onBackgroundMessage is set. I added dirty hack which allows the onPushClickReceived call on the Flutter side. In the log you can see onAttachedToEngine method is called after setting onBackgroundMessage handler, but, for example, onAttachedToActivity is not and as result lateinit property context has not been initialized. I can do more dirtier hack and make Context is static, but this only works if app started normally not from intent like click to push notification.

Is it possible to avoid unexpected plugin behavior when setting onBackgroundMessage?

Click To Expand
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Debug service listening on ws://127.0.0.1:50443/PwW3DWpbVlI=/ws
Syncing files to device Pixel 5...
W/FlutterJNI(23829): FlutterJNI.loadLibrary called more than once
I/ResourceExtractor(23829): Found extracted resources res_timestamp-1-1667644120243
W/FlutterJNI(23829): FlutterJNI.prefetchDefaultFontManager called more than once
W/FlutterJNI(23829): FlutterJNI.init called more than once
I/FLTFireBGExecutor(23829): Creating background FlutterEngine instance, with args: [--start-paused, --enable-dart-profiling]
I/flutter (23829): Android 13
I/flutter (23829): link, payload
I/MindboxAndroidPlugin(23829): onAttachedToEngine
D/CompatibilityChangeReporter(23829): Compat change id reported: 194532703; UID 10741; state: ENABLED
V/Volley  (23829): [78] CacheDispatcher.run: start new dispatcher
E/Mindbox (23829): MindboxRequest: <--- Error null https://invalid.configuration/v3/operations/async?dateTimeOffset=0&operation=MobilePush.ApplicationInstalled&deviceUUID=8bc83a74-1cef-4584-98f5-ee8f67b4bc3e&endpointId=endpointAndroid&transactionId=228ebf5c-2075-4140-a92e-9e806895461c TimeMls:35; 
E/Mindbox (23829): MindboxRequest: <--- Error null https://invalid.configuration/v1.1/customer/mobile-track-visit?dateTimeOffset=0&deviceUUID=8bc83a74-1cef-4584-98f5-ee8f67b4bc3e&transactionId=6b54a4e8-5fc5-40dc-9c8d-edb77b849666 TimeMls:4; 
I/FLTFireMsgService(23829): FlutterFirebaseMessagingBackgroundService started!
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): Failed to handle method call
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): kotlin.UninitializedPropertyAccessException: lateinit property context has not been initialized
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at cloud.mindbox.mindbox_android.MindboxAndroidPlugin.onMethodCall(MindboxAndroidPlugin.kt:90)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at android.os.Handler.handleCallback(Handler.java:942)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at android.os.Looper.loopOnce(Looper.java:201)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at android.app.ActivityThread.main(ActivityThread.java:7898)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#mindbox.cloud/flutter-sdk(23829): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/flutter (23829): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, lateinit property context has not been initialized, null, kotlin.UninitializedPropertyAccessException: lateinit property context has not been initialized
E/flutter (23829): 	at cloud.mindbox.mindbox_android.MindboxAndroidPlugin.onMethodCall(MindboxAndroidPlugin.kt:90)
E/flutter (23829): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (23829): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter (23829): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/flutter (23829): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter (23829): 	at android.os.Handler.handleCallback(Handler.java:942)
E/flutter (23829): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (23829): 	at android.os.Looper.loopOnce(Looper.java:201)
E/flutter (23829): 	at android.os.Looper.loop(Looper.java:288)
E/flutter (23829): 	at android.app.ActivityThread.main(ActivityThread.java:7898)
E/flutter (23829): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (23829): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (23829): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/flutter (23829): )
E/flutter (23829): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
E/flutter (23829): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
E/flutter (23829): <asynchronous suspension>
E/flutter (23829): 

@RoleWong
Copy link

RoleWong commented Nov 9, 2022

Hi, do anyone find the solution to solve this problems.
It seems all the method channel from native to flutter crashed.

@lifeapps-42
Copy link

Facing this too. I can call android methods from dart, but not vice versa(

@shivamsharma2710
Copy link

shivamsharma2710 commented Jan 6, 2023

@darshankawar It's been 3 months and the issue is still open without progress. Need an ETA of the fix or share any workaround.

@umbrellait-timur-khismatullin Did you find any solution which works well?

@umbrellait-nikolay-silantyev

@shivamsharma2710 Firebase documentation says:

When messages are received, an isolate is spawned (Android only, iOS/macOS does not require a separate isolate) allowing you to handle messages even when your application is not running.

Isolate created an another flutter engine for himself and register all plugins (call onAttachedToEngine in your Plugin android class).

In this case, the problem was that a static field was used in Plugin and had one instance of MethodChannel for several instances of flutter engine.

@shivamsharma2710
Copy link

@umbrellait-nikolay-silantyev Yes, I get it. I've tried this dirty hack which only fixes in foreground. For background, what did you do?

@umbrellait-nikolay-silantyev

I've refactored code and made channel field non-static (made as private field of TestPlugin)

@kkgowtham-engg-sdk
Copy link

kkgowtham-engg-sdk commented Jan 9, 2023

@umbrellait-nikolay-silantyev . Did that solved this issue? On making the channel field non static. I have channel field non static only. It didn't work for me. Link . For me still platform channels breaks with non static channel field in Plugin class.

@shivamsharma2710
Copy link

@umbrellait-nikolay-silantyev Your solution didn't work in my project. I've tried your repo as well and it also has an issue in background state.

@shivamsharma2710
Copy link

@darshankawar Still waiting for your reply on ETA or any workaround.

781flyingdutchman added a commit to 781flyingdutchman/background_downloader that referenced this issue Jan 23, 2023
firebase/flutterfire#9689

Made `channel` a regular field (non-static) and only set `backgroundChannel` (a static field) if it is null.  This should keep the first `backgroundChannel` alive.

Note that the `backgroundChannel` has to be static because it is called from the DownloadWorker, and it has no reference to the plugin.
781flyingdutchman added a commit to 781flyingdutchman/background_downloader that referenced this issue Jan 23, 2023
firebase/flutterfire#9689

Made `channel` a regular field (non-static) and only set `backgroundChannel` (a static field) if it is null.  This should keep the first `backgroundChannel` alive.

Note that the `backgroundChannel` has to be static because it is called from the DownloadWorker, and it has no reference to the plugin.
@keithcwk
Copy link

keithcwk commented Feb 2, 2023

Bumping this issue as well, used this suggestion but still does not work, its been months and this issue still persists.

1 similar comment
@keithcwk
Copy link

keithcwk commented Feb 2, 2023

Bumping this issue as well, used this suggestion but still does not work, its been months and this issue still persists.

shivamsharma2710 added a commit to CleverTap/clevertap-flutter that referenced this issue Feb 6, 2023
…breaks plugin's platform channel for sending method call from Android.

Issue has been fixed by creating the two method-channels in plugin's android class. One static method channel is reserved for Android to Dart communication and other is for Dart to Android communication.

Fixes, firebase/flutterfire#9689
@russellwheatley russellwheatley self-assigned this Feb 9, 2023
@russellwheatley
Copy link
Member

russellwheatley commented Feb 16, 2023

Hey @umbrellait-timur-khismatullin, I've investigated this issue. What I think is happening:

  1. The FlutterEngine is created and plugins are instantiated.
  2. The background handler is detected which creates a new FlutterEngine, reinitialising the plugins.
  3. You've created a delayed function execution based on the original context before the latest FlutterEngine was created. It is lost.

Step 2 is essential for the function of the background message handler, there is no way around it. If the context is changed in the intervening period for a delayed function tethered to the previous context, the message back to the Flutter side is going to get lost. For example, If I remove the delayed execution function wrapper, it works.

There isn't anything for FlutterFire to do as this is something for developers to be aware of when designing their app implementation. It is perhaps a limitation of the FlutterEngine if anything.

@kkgowtham-engg-sdk
Copy link

@russellwheatley As you mentioned, the issue is not only at the time of intervening period. When FlutterBackground Message Handler is added, the method channel callbacks from native to android is totally breaking.
In my case, I am having custom push click call back which I would be calling from Native android.
When this background listener is added and when push notification is clicked , the callback is not coming for whole application lifecycle.

You can checkout my reproducible example ,
https://github.com/kkgowtham-engg-sdk/flutter_callback_issue

In the MainActivity.kt onNewIntent() , I am sending callback to flutter. This callback never reaches the flutter as method channel is broken because flutter engine got re initialised

But flutter to native method channel communication is working. Only native to flutter is broken.

If this is a limitation with flutter engine itself, is there any alternative work around? As you can see many people having this issue, at least providing a dirty hack to make it temporarily work would be helpful.

@russellwheatley
Copy link
Member

@kkgowtham-engg-sdk - Is there not a lifecycle hook you can use to reinitialise the background handler every time the FlutterEngine is reinitialised? example

@danielgomezrico
Copy link

danielgomezrico commented Feb 20, 2023

@russellwheatley I dont understand why this was closed, can someone guide me how to fix it? What should be done on the library side to avoid the channel breakup?

@russellwheatley
Copy link
Member

@kkgowtham-engg-sdk - Is there not a lifecycle hook you can use to reinitialise the background handler every time the FlutterEngine is reinitialised? example

@danielgomezrico - have you tried using the lifecycle hook?

@danielgomezrico
Copy link

@russellwheatley can you elaborate more on that idea? I don't catch what do you mean 🙏🏻

@russellwheatley
Copy link
Member

The FlutterEngine is being reinitialised when the background message handler callback is registered. You need to reinitialise your plugin via onAttachedToEngine. This lifecycle hook is part of the FlutterPlugin interface.

Anything (e.g event listener) associated with the application context needs to be reinitialised in that method. Otherwise, you will lose the ability to communicate with the dart side.

@darshankawar darshankawar added the resolution: invalid This doesn't seem right and might not belong here. label Feb 22, 2023
@danielgomezrico
Copy link

danielgomezrico commented Feb 24, 2023

@russellwheatley I checked, thanks for the explanation, but I'm still lost, and it seems like onAttachedToEngine and onDetachedFromEngine are only called once on our plugin, so I'm a bit lost on what to do next to make it work

Thanks for the update, now I was able to see the onAttachedToEngine called twice, investigating

@russellwheatley
Copy link
Member

@danielgomezrico - that doesn't sound right. It is definitely called twice on android when using the firebase messaging plugin & you have a background message handler setup in your Flutter app.

@kkgowtham
Copy link

kkgowtham commented Mar 2, 2023

@russellwheatley . Even after reinitializing , it's not working. Only if call platform channel with MethodChannel instance created First time,it is working. When reinitialed due to onattachEngine called twice and when I call flutter method through MethodChannel instance created second time by Firebase.Onbackground message, it is not working. Only I am able to communicate through flutter through instance created first time.
I tried making the MethodChannel instance static and I will not reassign during reinitializing. But one corner I had was I will recreate MainActivity, the plugin got initialed third time with new flutter engine instance. Now communication only works with new platform channel instance . If I understand correctly, only when platform channel instance created with MainIsolate's flutter engine context will work.

So I made a dirty hack to save method channel instances in static hashSet and add method channel instances to it when onattachEngine is called every time .When I need to emit an event to flutter , I will call the same method with all MethodChannel instances, to avoid in future if another plugin like uses background isolates like flutter fire.

The thing I need to know is that, will it send multiple event if I call same function with different MethodChannel instances. I know its a dirty work around.

If you had better workaround please share with an example and some more explanation would be helpful

@firebase firebase locked and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android Issues / PRs which are specifically for Android. plugin: messaging resolution: invalid This doesn't seem right and might not belong here. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests