flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

Change AudioAttributes to the notifications in android

Open bornold opened this issue 3 years ago • 3 comments

Hello @MaikuB 👋 First of all, thank you so much for the plugin! Huge fan!

Have a use case where we would like to change AudioAttributes for the notifications here: https://github.com/MaikuB/flutter_local_notifications/blob/2c0b2db29fef939f1355cd708f8c5fee73deed22/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java#L953

Specifically to AudioAttributes.USAGE_ALARM

We are maintaining a fork so there is no problem for us just change the attribute, but I was wondering if there would be any interest in adding this to AndroidNotificationDetails?

If so, I would be happy to write a PR

bornold avatar Mar 07 '22 15:03 bornold

A PR would be welcome but would like know what the thought would be on how users of the plugin specify the attribute? If you're looking to expand this then I suspect it makes sense to allow any of the allowed attribute values to be specified then for backwards compatibility, assume the default value is AudioAttributes.USAGE_NOTIFICATION

MaikuB avatar Mar 08 '22 08:03 MaikuB

Cool! Yes, the user will specify the attribute in AndroidNotificationDetails as a enum that defaults to AudioAttributes.USAGE_NOTIFICATION.

Even though it does not really make any sense to specify some of the attributes available in AudioAttributes.Builder.setUsage for a notification I believe it's best to include them all.

Guess I'll start working on a PR that in the coming weeks branching of 10.0.0?

bornold avatar Mar 14 '22 07:03 bornold

This sounds like something that wouldn't be a breaking change so if that's the case, it could use master as the target branch so that this goes out in a 9.x release

MaikuB avatar Mar 14 '22 07:03 MaikuB