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

feature: configurable notificationChannel importance #3

Open
toonvanstrijp opened this issue Jan 4, 2021 · 9 comments
Open

feature: configurable notificationChannel importance #3

toonvanstrijp opened this issue Jan 4, 2021 · 9 comments

Comments

@toonvanstrijp
Copy link

It would be nice if we could specify the importance of the notification channel. This would allow a silent notification (one that doesn't appear continuously)

NotificationChannel chan1 = new NotificationChannel("default", "default", NotificationManager.IMPORTANCE_LOW);
@SayWut
Copy link
Owner

SayWut commented Jan 5, 2021

Its already implemented

image

or do you mean to somthing else?

@toonvanstrijp
Copy link
Author

@SayWut wow that's exactly what I meant! How did I miss that... :) my bad!

@toonvanstrijp
Copy link
Author

Screenshot_20210105-015540_One UI Home

It didn't work as expected. How can I have it the same as the "Android System" notification. That one is collapsed from the beginning :)

@toonvanstrijp toonvanstrijp reopened this Jan 5, 2021
@SayWut
Copy link
Owner

SayWut commented Jan 5, 2021

When I implemented this I checked if this works

The single line notification it depends on the OS and every android OS works differently, on some you need to use LOW on other you need to use MIN

I am not in front of my PC right now, I will check this later
but you can try this for now

https://stackoverflow.com/questions/50676819/android-o-single-line-notification-like-the-android-system-usb-charging-t

@SayWut
Copy link
Owner

SayWut commented Jan 5, 2021

from what I checked and tested there is no way to create a single line foreground service in android 8

when you use importance min the OS change the importance to higher lvl

Min notification importance: only shows in the shade, below the fold. This should not be used with Service#startForeground(int, Notification) since a foreground service is supposed to be something the user cares about so it does not make semantic sense to mark its notification as minimum importance. If you do this as of Android version Build.VERSION_CODES.O, the system will show a higher-priority notification about your app running in the background.

https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_MIN

@toonvanstrijp
Copy link
Author

I don't know if it makes a difference, but I'm using android 10 in the image above.

@SayWut
Copy link
Owner

SayWut commented Jan 5, 2021

I don't know if it makes a difference, but I'm using android 10 in the image above.

🤔 I will check on this

@SayWut
Copy link
Owner

SayWut commented Jan 5, 2021

I tried to play with it and I didn't find any solution that works, if you manage to create single line notification send me the solution I will try to implement it.
From what I tested and searched it is not possible to set the ForegroudService's notification importance lower then medium programmatically which is crucial for single line notification

@toonvanstrijp
Copy link
Author

Alright I'll test around and if I find something I'll let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants