I am using flutter local_notification. In my case i an using custom sound for notification and i want it to ring until someone taps it. but the issue is when notification come and user just swipe down the notification trey from the top it stops ringing i want it to stop when its taps.
here is the code
here is the code
`
showNotification(
{required RemoteMessage message, required bool initializeNotification}) {
if (initializeNotification) {
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
}
final iosSettings = DarwinInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: false,
requestSoundPermission: true,
defaultPresentAlert: true,
defaultPresentSound: true,
onDidReceiveLocalNotification: onDidReceiveLocalNotification,
);
const androidSettings =
AndroidInitializationSettings("@drawable/ic_notification");
final settings =
InitializationSettings(android: androidSettings, iOS: iosSettings);
flutterLocalNotificationsPlugin.initialize(
settings,
onDidReceiveNotificationResponse: selectNotification,
);
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
channel.id, channel.name,
importance: Importance.max,
icon: '@drawable/ic_notification',
sound: const RawResourceAndroidNotificationSound("notification_sound"),
color: Colors.transparent,
priority: Priority.high,
playSound: true,
autoCancel: true,
ongoing: true,
audioAttributesUsage: AudioAttributesUsage.alarm,
additionalFlags: Int32List.fromList(<int>[5])
// initializeNotification ? : null,
);
var iOSPlatformChannelSpecifics = const DarwinNotificationDetails(
presentAlert: true,
presentSound: true,
);
var platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics,
iOS: iOSPlatformChannelSpecifics);
String? tittle = "";
String? body = "";
Object? notification;
if (message.notification != null) {
notification = message.notification;
tittle = message.notification!.title;
body = message.notification!.body;
} else {
notification = message.data;
tittle = message.data["title"];
body = message.data["body"];
}
if (notification != null) {
flutterLocalNotificationsPlugin.show(
notification.hashCode, tittle, body, platformChannelSpecifics,
payload: jsonEncode(message.data));
}
onMessageOpenApp();
}` i have also used additionalflag