Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom notification #11

Closed
hacker1024 opened this issue Jan 2, 2019 · 21 comments
Closed

Custom notification #11

hacker1024 opened this issue Jan 2, 2019 · 21 comments
Assignees

Comments

@hacker1024
Copy link
Contributor

Is there any way to use a custom notification?

@ryanheise ryanheise self-assigned this Jan 2, 2019
@ryanheise
Copy link
Owner

ryanheise commented Jan 2, 2019

Do you mean something like remote views?

Note that audio_service uses NotificationCompat.MediaStyle to render a standard media-style notification and so it's currently limited by whatever customisation that offers.

Right now, it provides the following customisations:

  • Media description (title/subtitle/etc)
  • Actions
  • Artwork or background colour
  • Notification channel name

The short term goal would be to support all of the common customisations first, to the extent that that is possible with MediaStyle. Once they are all known, an informed decision can be made on how to integrate more advanced requirements into the plugin.

@hacker1024
Copy link
Contributor Author

Yeah, I meant standard MediaStyle customisations.

@ryanheise
Copy link
Owner

Are there any customisations in MediaStyle that you want supported in addition to the ones listed above?

@hacker1024
Copy link
Contributor Author

I don't know if this is already enabled, but an option to enable the colorized setting?

@ryanheise
Copy link
Owner

If you mean a setting that will pick a colour from the supplied artwork to use as the background colour, I believe that is what MediaStyle does by default when you provide the artwork.

@hacker1024
Copy link
Contributor Author

Another thing -
In the notification, it shows the song name, and then the artist on the second line. It would be nice to have an option to make the second line show "$artist - $album".

@hacker1024
Copy link
Contributor Author

Also, there should also be a notification channel description parameter.

@alexantenna
Copy link

alexantenna commented Jan 3, 2019

If you mean a setting that will pick a colour from the supplied artwork to use as the background colour, I believe that is what MediaStyle does by default when you provide the artwork.

Is this supported by the plugin? What should we do to utilize such effect?

@hacker1024
Copy link
Contributor Author

Is this supported by the plugin? What should we do to utilize such effect?

It's actually a feature build in to Android, and it's on by default.

@hacker1024
Copy link
Contributor Author

Is there a way to choose which actions to show in the collapsed notification?

@alexantenna
Copy link

It's actually a feature build in to Android, and it's on by default.

Damn, what's wrong with my notifications? :-) If notificationColor is omitted in AudioService.start my notification is just plain white (with artwork displayed). If notificationColor is provided notification is filled with the color.

@hacker1024
Copy link
Contributor Author

The feature was only added in 8.0.

@hacker1024
Copy link
Contributor Author

You could achieve a similar effect with the Palette tool, but since the library only supports setting the notification colour once, that's not currently possible.

@alexantenna
Copy link

The feature was only added in 8.0.

And my phone has 8.0. Looks like Huawei messed these things up in their EMUI 8.0 firmware, will wait for the 8.1 or 9.0 upgrade :-(

@hacker1024
Copy link
Contributor Author

There's no way to choose which actions to show in the collapsed mode. That's kinda important, as usually the most important controls aren't the first three.

@ryanheise
Copy link
Owner

On the request to format the second line as "$artist - $album", I've added some overrides in MediaItem to specify what you would like to be displayed on the first and second lines in the notification. They are displayTitle and displaySubtitle. These are handled natively by Android and I believe the way they work is that you have to at least specify displayTitle for any of them to take effect. So in your case you could do MediaItem(artist: artist, album: album, title: title, displayTitle: title, displaySubtitle: "$artist - $album", etc...).

For the option to set which controls show in the compact view, I've added a new property MediaControl.androidShowInCompactView.

@hacker1024
Copy link
Contributor Author

I don't need to use this personally, but I feel like we should be able to set the order of the compact notification actions as well.

@ryanheise
Copy link
Owner

That's fair. If I do that, I wouldn't want to do it both ways, so the androidShowInCompactView property would disappear and I'd add a parameter to AudioServiceBackground.setState to specify the list of indices to include in the compact view. Would you be happy with that change?

@hacker1024
Copy link
Contributor Author

That would be great, thanks.

@ryanheise
Copy link
Owner

The new parameter androidCompactActions for setState is now included in Release 0.0.14.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants