标签: awesome-notifications

Flutter 很棒的通知点击打开特定页面

我正在使用 Flutter 很棒的通知。当应用程序关闭时单击通知时,我想将其定向到应用程序内的特殊页面。对我来说最简单的方法是什么?

flutter flutter-notification awesome-notifications

7
推荐指数
1
解决办法
4902
查看次数

未处理的异常:MissingPluginException(在通道 Awesome_notifications 上找不到方法初始化的实现)

我已经在 main.dart 中初始化了 Awesome_notifications 插件当我热重启时,在调试控制台中我收到此错误:

\n
    E/flutter ( 4447): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel awesome_notifications)\nE/flutter ( 4447): #0      MethodChannel._invokeMethod\npackage:flutter/\xe2\x80\xa6/services/platform_channel.dart:165\nE/flutter ( 4447): <asynchronous suspension>\nE/flutter ( 4447): #1      AwesomeNotifications.initialize (package:awesome_notifications/src/awesome_notifications_core.dart:174:18)\nE/flutter ( 4447): <asynchronous suspension>\nE/flutter ( 4447):\nE/flutter ( 4447): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method isNotificationAllowed on channel awesome_notifications)\nE/flutter ( 4447): #0      MethodChannel._invokeMethod\npackage:flutter/\xe2\x80\xa6/services/platform_channel.dart:165\nE/flutter ( 4447): <asynchronous suspension>\n
Run Code Online (Sandbox Code Playgroud)\n

这是我的代码:

\n

主程序.dart

\n
Future<void> main() async {\n  WidgetsFlutterBinding();\n  await Hive.initFlutter();\n  if (!Hive.isAdapterRegistered(AddEventModelAdapter().typeId)) {\n    Hive.registerAdapter(AddEventModelAdapter());\n  }\n  AwesomeNotifications()\n …
Run Code Online (Sandbox Code Playgroud)

flutter awesome-notifications

7
推荐指数
1
解决办法
2万
查看次数

错误:用户必须有效并且有名称

我已经设置了与 Firebase Messaging 配合使用的所有内容。后台消息工作正常。但对于前台消息,我面临以下错误:用户必须有效并且有名称。

W/System.err(15714): java.lang.RuntimeException: User must be valid and have a name.
W/System.err(15714):    at android.app.Notification$MessagingStyle.validate(Notification.java:7229)
W/System.err(15714):    at android.app.Notification$Builder.build(Notification.java:6088)
W/System.err(15714):    at androidx.core.app.NotificationCompatBuilder.buildInternal(NotificationCompatBuilder.java:410)
W/System.err(15714):    at androidx.core.app.NotificationCompatBuilder.build(NotificationCompatBuilder.java:324)
W/System.err(15714):    at androidx.core.app.NotificationCompat$Builder.build(NotificationCompat.java:2430)
W/System.err(15714):    at me.carda.awesome_notifications.notifications.NotificationBuilder.getNotificationBuilderFromModel(NotificationBuilder.java:425)
W/System.err(15714):    at me.carda.awesome_notifications.notifications.NotificationBuilder.createNotification(NotificationBuilder.java:110)
W/System.err(15714):    at me.carda.awesome_notifications.notifications.NotificationSender.showNotification(NotificationSender.java:209)
W/System.err(15714):    at me.carda.awesome_notifications.notifications.NotificationSender.doInBackground(NotificationSender.java:128)
W/System.err(15714):    at me.carda.awesome_notifications.notifications.NotificationSender.doInBackground(NotificationSender.java:34)
W/System.err(15714):    at android.os.AsyncTask$3.call(AsyncTask.java:394)
W/System.err(15714):    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err(15714):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
W/System.err(15714):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err(15714):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err(15714):    at java.lang.Thread.run(Thread.java:923)
Run Code Online (Sandbox Code Playgroud)

它是这样调用的:

     AwesomeNotifications().createNotification(
        content: NotificationContent(
          id: uniqueIdInt(),
          channelKey: 'basic_channel',
          title: notification!.title,
          body: notification.body,
          notificationLayout: NotificationLayout.Messaging,
        ),
      );
Run Code Online (Sandbox Code Playgroud)

有什么线索吗?

dart flutter firebase-cloud-messaging awesome-notifications

3
推荐指数
1
解决办法
782
查看次数

Swift 编译器错误(Xcode):没有这样的模块“shared_preferences_ios” - Flutter

笔记

\n
    \n
  • 最近更新至 Xcode 版本 14.2 (14C18)
  • \n
  • Flutter 3.7.0 \xe2\x80\xa2 通道稳定
  • \n
\n

问题

\n

当运行我的 iOS 版 Flutter 应用程序时,出现以下错误:

\n
Xcode build done.                                           86.8s\nFailed to build iOS app\nCould not build the precompiled application for the device.\nSwift Compiler Error (Xcode): No such module \'shared_preferences_ios\'\n/Users/tomasward/Desktop/fredi_new/ios/Runner/AppDelegate.swift:3:7\n
Run Code Online (Sandbox Code Playgroud)\n

这是从这段代码派生出来的AppDelegate.swift

\n
import UIKit\nimport Flutter\nimport awesome_notifications\nimport shared_preferences_ios //error here\n\n@UIApplicationMain\n@objc class AppDelegate: FlutterAppDelegate {\n  override func application(\n    _ application: UIApplication,\n    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?\n  ) -> Bool {\n    GeneratedPluginRegistrant.register(with: self)\n      \n      if …
Run Code Online (Sandbox Code Playgroud)

xcode notifications dart flutter awesome-notifications

3
推荐指数
1
解决办法
2659
查看次数

找不到 AwesomeNotifications().actionStream

我想在我的颤动通知中添加一个按钮。按钮已显示,但我无法捕捉到该操作。

AwesomeNotifications().createNotification(
    content: NotificationContent(
        id: 888,
        channelKey: 'NetVideo',
        title: 'NetVideo',
        body: 'Server in ascolto'),
    actionButtons: <NotificationActionButton>[
      NotificationActionButton(key: 'yes', label: 'Yes'),
    ],
  );
Run Code Online (Sandbox Code Playgroud)

AwesomeNotifications().actionStream 仍然存在吗?

flutter awesome-notifications

2
推荐指数
1
解决办法
3789
查看次数