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

Disable Channel badges for API 26 and lower #132

Closed
wants to merge 1 commit into from

Conversation

tzugen
Copy link

@tzugen tzugen commented Jul 30, 2022

Fixes #131

@icbaker icbaker self-assigned this Aug 1, 2022
@@ -374,6 +374,7 @@ private void ensureNotificationChannel() {
NotificationChannel channel =
new NotificationChannel(
NOTIFICATION_CHANNEL_ID, NOTIFICATION_CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
channel.setShowBadge(false);
Copy link
Collaborator

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

Copy link
Author

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...

Copy link
Collaborator

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.

Copy link
Author

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!

@icbaker
Copy link
Collaborator

icbaker commented Aug 2, 2022

I will merge this with the additional gating and comment - no need to add any more commits here.

@icbaker icbaker changed the base branch from release to main August 3, 2022 13:03
@icbaker icbaker changed the base branch from main to release August 3, 2022 13:04
@icbaker
Copy link
Collaborator

icbaker commented Aug 3, 2022

Ah, just spotted this PR is made against the release branch, could you update it to be against the main branch as described in https://github.com/androidx/media/blob/release/CONTRIBUTING.md#pull-requests? I tried just changing it in the GitHub UI but it created a lot of conflicts - it may be easier to just open a new one and close this one?

@tzugen tzugen changed the base branch from release to main August 4, 2022 05:14
@tzugen tzugen changed the base branch from main to release August 4, 2022 05:15
@tzugen
Copy link
Author

tzugen commented Aug 4, 2022

Closing, see #141

@tzugen tzugen closed this Aug 4, 2022
@androidx androidx locked and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API <=26: MediaNotification will add a Badge to the App Icon
2 participants