I'm trying to add notifications to my app using the flutter_local_notifications plugin but AndroidInitializationSettings requires a drawable resource and throws this error when one is not provided:
"PlatformException (PlatformException(INVALID_ICON, The resource could not be found. Please make sure it has been added as a drawable resource to your Android head project., null))"
The problem is that I don't know where Android head project is located.
A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
Setting up the Notification Service Open the file and import the following at the top: import 'package:flutter_local_notifications/flutter_local_notifications. dart'; import 'package:timezone/timezone. dart' as tz; import 'package:timezone/data/latest.
To achieve an image on local notification, first add the awesome_notifications Flutter package by adding the following lines in pubspec. yaml file. awesome_notifications is the best flutter package we got to show local notifications in the Flutter app.
Hope you have solved it with above answered method, but I have solved with another method by using existing app icon.
var initializationSettingsAndroid = new AndroidInitializationSettings('@mipmap/ic_launcher');
Add your icon to [projectFolder]/android/app/src/main/res/drawable
(for example app_icon.png
) and use that name here:
var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With