Closed
Description
Describe the bug
Currently the documentation does NOT support the new Flutter Android v2 embedding that came along with flutter 1.12.13. The function GeneratedPluginRegistrant.registerWith(registry);
no longer accepts a io.flutter.plugin.common.PluginRegistry
object, but a io.flutter.embedding.engine.FlutterEngine
object.
Current code in documentation:
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
Newer code attempt with error:
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
public class Application extends FlutterApplication implements PluginRegistry.PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry); // ERROR: Expects io.flutter.embedding.engine.FlutterEngine
}
}
To Reproduce
Steps to reproduce the behavior:
- Run
flutter create -a java example
- Follow firebase_messaging background messaging instructions
- Notice GeneratedPluginRegistrant.registerWith(registry) no longer expects a PluginRegistry type
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
stoppiNeobiz commentedon Jan 26, 2020
any solution for this error?
sgehrman commentedon Jan 27, 2020
same issue
gakubhat commentedon Jan 29, 2020
Solved it with following:
app/src/build.gradle
add the following:
implementation "com.google.firebase:firebase-messaging:20.1.0"
Application.kt
woprandi commentedon Feb 19, 2020
That would be better to get an official fix and not have to do a workaround with potential side effect
woprandi commentedon Feb 20, 2020
I have another issue with the @gakubhat workaround (#116)
I followed this workaround : https://www.djamware.com/post/5e4b26e26cdeb308204b427f/flutter-tutorial-firebase-cloud-messaging-fcm-push-notification
Frustrating to have so many issues on a important plugin...
Zazo032 commentedon May 15, 2020
@Ehesp hi, is there any ETA for solving this?
FabulousGee commentedon Jul 28, 2020
This issue has been opened about half a year ago and still not under real investigation? C'mon guys, this is a real show stopper, especially for newbies that want to get into this stuff...
Just set up a new, standard flutter project and follow the current documentation. It won't work...
kroikie commentedon Jul 29, 2020
@ALL Sorry about the delay here, we are currently working on updating the messaging plugin, the documentation will be updated according to those final updates. We should have more on this very soon.
videjunior commentedon Aug 10, 2020
É só você usar o PluginRegistry.PluginRegistrantCallback dessa forma:
Funciona normalmente o "backgroundMessage handler" no meu projeto já modificado para embedding V2.
josh-burton commentedon Aug 20, 2020
I'm a bit confused about which plugins need to be manually registered in the
registerWith
method.Is it any plugin that we are using in the background, or is it plugins that haven't yet updated to the v2 embedding?
pangj commentedon Oct 24, 2020
Has this issue be resolved now, anybody knows? It is really important plugin for the Flutter framework.
LasseRosenow commentedon Oct 24, 2020
It will be resolved "very very soon", when version 8.0.0 will be released.
Salakar commentedon Nov 5, 2020
Hey all 👋
As part of our roadmap (#2582) we've just shipped a complete rework of the
firebase_messaging
plugin that aims to solve this and many other issues. Specifically v2 embedding is now supported and requires no documentation/manual steps unless you still need to use v1 embedding.If you can, please try out the dev release (see the migration guide for upgrading and for changes) and if you have any feedback then join in the discussion here.
Given the scope of the rework I'm going to go ahead and close this issue in favor of trying out the latest plugin.
Thanks everyone.