To customize the Android notification display and behavior on Flutter, consider using a package called flutter_local_notifications which allows granular configuration of local Android notifications, instead of calling Pushy.notify(...)
in your backgroundNotificationListener()
.
Example code to display a local notification with flutter_local_notifications:
const AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails( 'your channel id', 'your channel name', 'your channel description', importance: Importance.max, priority: Priority.high, showWhen: false); const NotificationDetails platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics); await flutterLocalNotificationsPlugin.show( 0, 'plain title', 'plain body', platformChannelSpecifics, payload: 'item x');
Please refer to the docs for configuring custom notification icons and sounds.
To migrate to flutter_local_notifications, remove the following line of code in your backgroundNotificationListener()
and invoke the plugin instead:
Pushy.notify(notificationTitle, notificationText, data);