You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider registering plugins in FlutterApplication #9215
From @collinjackson: consider autoregistering in the FlutterApplication and adding an activity lifecycle callback so plugins get added in onCreate automatically without having extra code in the client activity.
It would also be nice if plugins can be informed about the "onNewIntent" event. That would for example make the setup for the firebase_messaging plugin a lot simpler, as we could then drop step 2ii from our instructions: https://github.com/flutter/firebase_messaging
I agree that FlutterActivity should allow plugins to register for onNewIntent and various other Activity methods, like onUserLeaveHint(). It might be better to fix #3671 first, since it could have impact on the API design if plugins can exist outside of a FlutterActivity.
#9715 and friends contains a basic approach that we can extend until it handles all the Activity methods we want. It does not tie plugins to a FlutterActivity, though still to an Activity. Comments/suggestions on the PRs are most welcome.
BTW: I don't immediately see a simple way to avoid plugin registration code in the client's Activity as long as we have the auto-generated PluginRegistry.java (soon to become GeneratedPluginRegistrant.java).
Calling the auto-generated code from flutter/engine framework code seems to require reflection which (in my view) isn't simple, even if it's just a few lines of Java.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
mit-mit commentedon Apr 5, 2017
@mravn-google can you look into this a bit?
mit-mit commentedon Apr 7, 2017
Tagging M2 as this impacts API stability
collinjackson commentedon Apr 28, 2017
@goderbauer
goderbauer commentedon May 5, 2017
It would also be nice if plugins can be informed about the "onNewIntent" event. That would for example make the setup for the firebase_messaging plugin a lot simpler, as we could then drop step 2ii from our instructions: https://github.com/flutter/firebase_messaging
collinjackson commentedon May 5, 2017
I agree that
FlutterActivityshould allow plugins to register foronNewIntentand various otherActivitymethods, likeonUserLeaveHint(). It might be better to fix #3671 first, since it could have impact on the API design if plugins can exist outside of aFlutterActivity.mravn-google commentedon May 5, 2017
#9715 and friends contains a basic approach that we can extend until it handles all the
Activitymethods we want. It does not tie plugins to aFlutterActivity, though still to anActivity. Comments/suggestions on the PRs are most welcome.Android:
iOS:
mravn-google commentedon May 5, 2017
BTW: I don't immediately see a simple way to avoid plugin registration code in the client's
Activityas long as we have the auto-generatedPluginRegistry.java(soon to becomeGeneratedPluginRegistrant.java).Calling the auto-generated code from
flutter/engineframework code seems to require reflection which (in my view) isn't simple, even if it's just a few lines of Java.mravn-google commentedon May 5, 2017
onUserLeaveHintandonNewIntentare now both included:collinjackson commentedon May 5, 2017
Thanks! I don't have any particular attachment to
onUserLeaveHint, it's just an example, but hopefully we'll get all the useful ones over time.goderbauer commentedon May 5, 2017
Nice!
mravn-google commentedon May 9, 2017
Fixed by #9715 and friends.
github-actions commentedon Sep 5, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.