-
Notifications
You must be signed in to change notification settings - Fork 337
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
Disable Channel badges for API 26 and lower #132
Conversation
@@ -374,6 +374,7 @@ private void ensureNotificationChannel() { | |||
NotificationChannel channel = | |||
new NotificationChannel( | |||
NOTIFICATION_CHANNEL_ID, NOTIFICATION_CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW); | |||
channel.setShowBadge(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linked issue (#131) and the title of this PR indicate you expect this to only affect API 26 and below, but this line is only executed on API 26 and above (since API < 26 will return early above on L372).
So is it more correct to describe this as a problem specific to API 26? If so, it might be clearer to gate this with Util.SDK_INT == 26
with a comment.
Actually: I did some quick testing on a Pixel 2 emulator on different API levels, I see a badge on API 26 and 27, but not 28 - do you agree with that? In that case, let's gate it on Util.SDK_INT == 26 || Util.SDK_INT == 27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I share your observation.
I am not sure I understand why the code to setup the channel is not executed on ApI 26, because Channels were introduced with API 26...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand why the code to setup the channel is not executed on ApI 26, because Channels were introduced with API 26...
Why do you believe that to be the case? This code is executed when Util.SDK_INT < 26
is false
, i.e. when SDK_INT >= 26
is true
, i.e. it is executed on API 26.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah misunderstood your last comment!
thanks!
I will merge this with the additional gating and comment - no need to add any more commits here. |
Ah, just spotted this PR is made against the |
Closing, see #141 |
Fixes #131