真棒通知:无效通知我正在使用的真棒通知包在颤振


E/Android: Awesome Notifications: Invalid notification (no valid small icon): Notification(channel=basic_channel shortcut=null contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x11 color=0xff009688 vis=PRIVATE) (NotificationThread:58)
W/System.err(25254): me.carda.awesome_notifications.core.exceptions.AwesomeNotificationsException: Invalid notification (no valid small icon): Notification(channel=basic_channel shortcut=null contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x11 color=0xff009688 vis=PRIVATE)
W/System.err(25254): at android.app.NotificationManager.fixNotification(NotificationManager.java:606)
W/System.err(25254): at android.app.NotificationManager.notifyAsUser(NotificationManager.java:585)
W/System.err(25254): at android.app.NotificationManager.notify(NotificationManager.java:534)
W/System.err(25254): at android.app.NotificationManager.notify(NotificationManager.java:510)
W/System.err(25254): at me.carda.awesome_notifications.core.managers.StatusBarManager.showNotificationOnStatusBar(StatusBarManager.java:86)
W/System.err(25254): at me.carda.awesome_notifications.core.threads.NotificationSender.showNotification(NotificationSender.java:260)
W/System.err(25254): at me.carda.awesome_notifications.core.threads.NotificationSender.doInBackground(NotificationSender.java:147)
W/System.err(25254): at me.carda.awesome_notifications.core.threads.NotificationSender.doInBackground(NotificationSender.java:32)
W/System.err(25254): at me.carda.awesome_notifications.core.threads.NotificationThread.runOnForegroundThread(NotificationThread.java:106)
W/System.err(25254): at me.carda.awesome_notifications.core.threads.NotificationThread.execute(NotificationThread.java:34)
W/System.err(25254): at me.carda.awesome_notifications.core.threads.NotificationSender.send(NotificationSender.java:101)
W/System.err(25254): at me.carda.awesome_notifications.core.AwesomeNotifications.createNotification(AwesomeNotifications.java:569)
W/System.err(25254): at me.carda.awesome_notifications.AwesomeNotificationsPlugin.channelMethodCreateNotification(AwesomeNotificationsPlugin.java:1274)

您是否像下面提到的代码一样初始化了您出色的通知插件?

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await AwesomeNotifications().initialize(
// set the icon to null if you want to use the default app icon
'resource://drawable/res_app_icon',
[
NotificationChannel(
channelGroupKey: 'basic_channel_group',
channelKey: 'basic_channel',
channelName: 'Basic notifications',
channelDescription: 'Notification channel for basic tests',
defaultColor: Color(0xFF9D50DD),
ledColor: Colors.white)
],
// Channel groups are only visual and are not required
channelGroups: [
NotificationChannelGroup(
channelGroupKey: 'basic_channel_group',
channelGroupName: 'Basic group')
],
debug: true
);

runApp(const MyApp());
}

从图像路径中删除图像的扩展,如下所示:

'resource://drawable/res_notf_icon'

最新更新