Issue
I have an error message.. Exception has occurred. PlatformException (PlatformException(INVALID_ICON, The resource grocery could not be found. Please make sure it has been added as a drawable resource to your Android head project., null))
The issue is that I can not find which asset or icon is missing.
The error is appearing when running flutterLocal NotificationPlugin.initialize
The app freeze after signing in.
All the files are upto date.
Solution
You have to follow these steps.
Add the icon to drawable and mipmap folders which you want to show in the notification bar.
Then add this in the manifest file inside <application tag.
android:icon="@mipmap/ic_launcher"
Finally initialize the plugin
Future<void> showNotification(String title, String subtitle, String action) async { var androidPlatformChannelSpecifics = AndroidNotificationDetails( 'your channel id', 'your channel name', 'your channel description', style: AndroidNotificationStyle.BigText, importance: Importance.Max, priority: Priority.High, ticker: 'ticker', icon: "@mipmap/ic_launcher"); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); var platformChannelSpecifics = NotificationDetails( androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); await flutterLocalNotificationsPlugin.show( 0, '$title', '$subtitle', platformChannelSpecifics, payload: action);}
Call the function where you configure the receiver of the notification.
Answered By - Md. Khairul Islam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.