Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Implemented clearBadge for Android #1030

Merged
merged 2 commits into from
Jun 29, 2016
Merged

Conversation

Alex-Sessler
Copy link
Contributor

Description

I added the init parameter "clearBadge" which is treated the same as the others and stored to SharedPreferences. If it's set, the app sets the badge number to 0 on init. Also, when a notification is receviced, the badge number is immediately cleared in order to leave the config of the badge through notification parameter untouched. Now when a notification is recevied, the badge is cleared before the notification content is processed, therefore any badge numbers set in the notification will be respected. I tried to implement this as close to the iOS implementation as possible.

Related Issue

#999

Motivation and Context

Even though I was not setting the Badge Number, it was some times (on specific devices) appearing out of nowhere after init. I wanted to have a way to make sure that the Badge Number is not shown by accident.

How Has This Been Tested?

I manually added a badge number through the "setApplicationBadgeNumber" function. Then I restarted the app causing the init function to trigger. The badge number was immediately cleared. I also set the BadgeNumber after init and sent a notification that had no badge number arguments. The badge number was also cleared immediately.

I only did manual tests on Android devices.

There shouldn't be any unexpected side effects on other code.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@macdonst macdonst merged commit b7ef370 into phonegap:master Jun 29, 2016
@macdonst
Copy link
Member

Thanks @Alex-Sessler

@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants