Skip to content

[Error][Android] MissingPluginException(No implementation found for method getWidgetData on channel home_widget) #357

@ngominhtrungit

Description

@ngominhtrungit

What happened?

`@pragma('vm:entry-point')
Future myBackgroundMessageHandler(RemoteMessage message) async {
await Firebase.initializeApp();
await SharePreferenceManager.initSharePreference();
// initial ref

try {
if (message.data["notification_type"] == "1") {
final widgetHelper = _BackgroundWidgetHelper();
print('🎯 Background _BackgroundWidgetHelper ok');
await HomeWidget.saveWidgetData("title", message.notification?.title);
HomeWidget.updateWidget(...)
}

} catch (e) {
print('🎯 Background handler error: $e');
}
}`

1, Android Background mode => When receive notification in background => I have config using HomeWidget.saveWidgetData, HomeWidget.updateWidget

But: MissingPluginException(No implementation found for method saveWidgetData on channel home_widget)

What do you expect?

how to using func HomeWidget.saveWidgetData or HomeWidget.updateWidget, ... when background mode Android

Relevant log output

Execute in a terminal and put output into the code block below

Output of: flutter doctor -v
[✓] Flutter (Channel stable, 3.22.3, on macOS 15.5 24F74 darwin-arm64, locale en-VN)
• Flutter version 3.22.3 on channel stable at /xxx/3.22.3
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b0850beeb2 (12 months ago), 2024-07-16 21:43:41 -0700
• Engine revision 235db911ba
• Dart version 3.4.4
• DevTools version 2.34.3

On which Platform do you experience this issue?

Android

Other information

No response

Are you interested in working on a PR for this?

  • I want to work on this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions