在后台显示预定的通知

问题描述

我正在尝试通过从Internet提取时间表并使用Flutter_local_notification安排通知来设置剩余通知。我想每天在后台获取一次互联网,并安排通知(即使该应用未打开)。我正在使用background_fetch运行后台任务。运行后台任务没有问题,但是当应用未打开时Flutter_local_notification无法正常工作。当应用程序处于前台后台时,相同的代码可以正常运行。这是我收到的错误消息。 Tried to automatically register plugins with FlutterEngine (io.Flutter.embedding.engine.FlutterEngine@16635ff) but Could not find and invoke the GeneratedpluginRegistrant.

el dexterous.com/Flutter/local_notifications)
10-30 17:46:16.097 18516 18657 E Flutter : #0      MethodChannel._invokeMethod (package:Flutter/src/services/platform_channel.dart:157:7)
10-30 17:46:16.097 18516 18657 E Flutter : <asynchronous suspension>
10-30 17:46:16.097 18516 18657 E Flutter : #1      MethodChannel.invokeMethod (package:Flutter/src/services/platform_channel.dart:332:12)
10-30 17:46:16.097 18516 18657 E Flutter : #2      AndroidFlutterlocalnotificationsPlugin.initialize (package:Flutter_local_notifications/src/platform_Flutter_local_notifications.dart:67
:27)
10-30 17:46:16.097 18516 18657 E Flutter : #3      FlutterlocalnotificationsPlugin.initialize (package:Flutter_local_notifications/src/Flutter_local_notifications_plugin.dart:97:13)
10-30 17:46:16.097 18516 18657 E Flutter : #4      _onBackgroundFetch (package:oxfam/ui/views/home/home_view.dart:203:12)
10-30 17:46:16.097 18516 18657 E Flutter : #5      _rootRunUnary (dart:async/zone.dart:1198:47)
10-30 17:46:16.097 18516 18657 E Flutter : #6      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
10-30 17:46:16.097 18516 18657 E Flutter : #7      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
10-30 17:46:16.097 18516 18657 E Flutter : #8      Future._propagatetoListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
10-30 17:46:16.097 18516 18657 E Flutter : #9      Future._propagatetoListeners (dart:async/future_impl.dart:725:32)
10-30 17:46:16.097 18516 18657 E Flutter : #10     Future._completeWithValue (dart:async/future_impl.dart:529:5)
10-30 17:46:16.097 18516 18657 E Flutter : #11     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
10-30 17:46:16.097 18516 18657 E Flutter : #12     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
10-30 17:46:16.097 18516 18657 E Flutter : #13     Query.get (package:cloud_firestore/src/query.dart)
10-30 17:46:16.097 18516 18657 E Flutter : #14     _rootRunUnary (dart:async/zone.dart:1198:47)
10-30 17:46:16.097 18516 18657 E Flutter : #15     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
10-30 17:46:16.097 18516 18657 E Flutter : #16     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
10-30 17:46:16.097 18516 18657 E Flutter : #17     Future._propagatetoListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
10-30 17:46:16.097 18516 18657 E Flutter : #18     Future._propagatetoListeners (dart:async/future_impl.dart:725:32)
10-30 17:46:16.097 18516 18657 E Flutter : #19     Future._completeWithValue (dart:async/future_impl.dart:529:5)
10-30 17:46:16.097 18516 18657 E Flutter : #20     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
10-30 17:46:16.097 18516 18657 E Flutter : #21     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
10-30 17:46:16.097 18516 18657 E Flutter : #22     MethodChannelQuery.get (package:cloud_firestore_platform_interface/src/method_channel/method_channel_query.dart)
10-30 17:46:16.097 18516 18657 E Flutter : #23     _rootRunUnary (dart:async/zone.dart:1198:47)
10-30 17:46:16.097 18516 18657 E Flutter : #24     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
10-30 17:46:16.097 18516 18657 E Flutter : #25     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
10-30 17:46:16.097 18516 18657 E Flutter : #26     Future._propagatetoListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
10-30 17:46:16.097 18516 18657 E Flutter : #27     Future._propagatetoListeners (dart:async/future_impl.dart:725:32)
10-30 17:46:16.097 18516 18657 E Flutter : #28     Future._completeWithValue (dart:async/future_impl.dart:529:5)
10-30 17:46:16.097 18516 18657 E Flutter : #29     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
10-30 17:46:16.097 18516 18657 E Flutter : #30     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
10-30 17:46:16.097 18516 18657 E Flutter : #31     MethodChannel.invokeMapMethod (package:Flutter/src/services/platform_channel.dart)
10-30 17:46:16.097 18516 18657 E Flutter : #32     _rootRunUnary (dart:async/zone.dart:1198:47)
10-30 17:46:16.097 18516 18657 E Flutter : #33     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
10-30 17:46:16.097 18516 18657 E Flutter : #34     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
10-30 17:46:16.097 18516 18657 E Flutter : #35     Future._propagatetoListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
10-30 17:46:16.097 18516 18657 E Flutter : #36     Future._propagatetoListeners (dart:async/future_impl.dart:725:32)
10-30 17:46:16.097 18516 18657 E Flutter : #37     Future._completeWithValue (dart:async/future_impl.dart:529:5)
10-30 17:46:16.097 18516 18657 E Flutter : #38     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
10-30 17:46:16.097 18516 18657 E Flutter : #39     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
10-30 17:46:16.097 18516 18657 E Flutter : #40     MethodChannel._invokeMethod (package:Flutter/src/services/platform_channel.dart)
10-30 17:46:16.097 18516 18657 E Flutter : #41     _rootRunUnary (dart:async/zone.dart:1198:47)
10-30 17:46:16.097 18516 18657 E Flutter : #42     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
10-30 17:46:16.097 18516 18657 E Flutter : #43     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
10-30 17:46:16.097 18516 18657 E Flutter : #44     Future._propagatetoListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
10-30 17:46:16.097 18516 18657 E Flutter : #45     Future._propagatetoListeners (dart:async/future_impl.dart:725:32)
10-30 17:46:16.097 18516 18657 E Flutter : #46     Future._completeWithValue (dart:async/future_impl.dart:529:5)
10-30 17:46:16.097 18516 18657 E Flutter : #47     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
10-30 17:46:16.097 18516 18657 E Flutter : #48     _rootRun (dart:async/zone.dart:1190:13)
10-30 17:46:16.097 18516 18657 E Flutter : #49     _CustomZone.run (dart:async/zone.dart:10
10-30 17:46:16.099 18516 18657 E Flutter : [ERROR:Flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method show on channel dex
terous.com/Flutter/local_notifications)
10-30 17:46:16.099 18516 18657 E Flutter : #0      MethodChannel._invokeMethod (package:Flutter/src/services/platform_channel.dart:157:7)
10-30 17:46:16.099 18516 18657 E Flutter : <asynchronous suspension>
10-30 17:46:16.099 18516 18657 E Flutter : #1      MethodChannel.invokeMethod (package:Flutter/src/services/platform_channel.dart:332:12)
10-30 17:46:16.099 18516 18657 E Flutter : #2      AndroidFlutterlocalnotificationsPlugin.show (package:Flutter_local_notifications/src/platform_Flutter_local_notifications.dart:137:21)
10-30 17:46:16.099 18516 18657 E Flutter : #3      FlutterlocalnotificationsPlugin.show (package:Flutter_local_notifications/src/Flutter_local_notifications_plugin.dart:136:13)
10-30 17:46:16.099 18516 18657 E Flutter : #4      _showNotificationWithDefaultSound (package:oxfam/ui/views/home/home_view.dart:231:14)
10-30 17:46:16.099 18516 18657 E Flutter : #5      _onBackgroundFetch (package:oxfam/ui/views/home/home_view.dart:204:7)
10-30 17:46:16.099 18516 18657 E Flutter : #6      _rootRunUnary (dart:async/zone.dart:1198:47)
10-30 17:46:16.099 18516 18657 E Flutter : #7      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
10-30 17:46:16.099 18516 18657 E Flutter : #8      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
10-30 17:46:16.099 18516 18657 E Flutter : #9      Future._propagatetoListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
10-30 17:46:16.099 18516 18657 E Flutter : #10     Future._propagatetoListeners (dart:async/future_impl.dart:725:32)
10-30 17:46:16.099 18516 18657 E Flutter : #11     Future._completeWithValue (dart:async/future_impl.dart:529:5)
10-30 17:46:16.099 18516 18657 E Flutter : #12     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
10-30 17:46:16.099 18516 18657 E Flutter : #13     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
10-30 17:46:16.099 18516 18657 E Flutter : #14     Query.get (package:cloud_firestore/src/query.dart)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)