我正在使用pushy-flutter进行推送通知服务。但是当应用程序被杀死时,我的应用程序无法推送通知。它仅在应用程序运行或我最小化应用程序时运行良好。从调试控制台,我可以看到应用程序已成功收到通知
[+8340 ms] D/Pushy ( 6919): Received push for package com.afabasia.afab
[ ] D/Pushy ( 6919): {message=Hello Hell}
[ +8 ms] D/Pushy ( 6919): Invoking push receiver via reflection:
me.pushy.sdk.flutter.internal.PushyInternalReceiver
[ ] D/Pushy ( 6919): Handling notification in Flutter background isolate
[ +4 ms] I/flutter ( 6919): Pushy: _isolate() received notfication
[ +2 ms] I/flutter ( 6919): Pushy notification received: {__json: {"message":"Hello Hell"}, message: Hello Hell}
[ ] I/flutter ( 6919): Received notification: {__json: {"message":"Hello Hell"}, message: Hello Hell}
但是当我调用该函数时Pushy.notifiy(...);
,它会告诉我这个错误
[ +14 ms] E/flutter ( 6919): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method notify on channel
me.pushy.sdk.flutter/methods)
我已经尝试过 pushy 演示项目,它运行良好,仅在我的项目中,当应用程序被终止时它无法推送通知。我是否错过了一些配置,以使我的应用程序在应用程序被杀死后无法获取 Pushy 库?
下面是我的结果flutter doctor -v
[√] Flutter (Channel stable, 1.22.1, on Microsoft Windows [Version 10.0.18363.1440], locale en-MY)
• Flutter version 1.22.1 at C:\Users\zhanm\Desktop\flutter sdk\flutter_1.22.1\flutter
• Framework revision f30b7f4db9 (6 months ago), 2020-10-08 10:06:30 -0700
• Engine revision 75bef9f6c8
• Dart version 2.10.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\zhanm\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = C:\Users\zhanm\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 49.0.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.54.3)
• VS Code at C:\Users\zhanm\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0
[√] Connected device (1 available)`
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!