I am new to flutter.I have started to create a reminder app.I am trying to call a push notification on android alarm call back.I am using awesome_notifications. On call back I am calling _ringAlarm()
.I have pasted it below.
It says D/NotificationSender( 5192): Notification created
, but nothing shows on screen.
This exception was thrown while running:
W/System.err( 5192): java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=basic_channel shortcut=null contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x11 color=0xff9d50dd vis=UNKNOWN(2))
Future _ringAlarm() async {
AwesomeNotifications().initialize(
'resource://drawable/logo.png',
[
NotificationChannel(
channelKey: 'basic_channel',
channelName: 'Basic notifications',
channelDescription: 'Notification channel for basic tests',
defaultColor: Color(0xFF9D50DD),
ledColor: Colors.white
)
]
);
AwesomeNotifications().isNotificationAllowed().then((isAllowed) {
if (!isAllowed) {
AwesomeNotifications().requestPermissionToSendNotifications();
}
});
AwesomeNotifications().createNotification(
content: NotificationContent(
id: 10,
channelKey: 'basic_channel',
title: 'Simple Notification',
body: 'Simple body'
)
);
}
On top of Workflop's answer, I also had to uninstall the app from my phone, then run the installation again on Android Studio.
I had the same issue when adding an image to my app. It seems to be related to the debug cache.
I also found out that the source image is extremely restricted, but somehow this is not explained in the Awesome Notifications repo. Apparently, images must be 120x120 resolution at max and contain only simple graphics, not including pasted images. It only worked for me with text and vectorial graphics.