windows7lake / app_badge_plus

A Flutter plugin for adding badges to your app icon.
MIT License
16 stars 6 forks source link

AppBadgePlus.updateBadge(0) not working #10

Open RuiTB opened 4 weeks ago

RuiTB commented 4 weeks ago

when calling AppBadgePlus.updateBadge(0) on Android the app badge number stop depending on the package and start counting the notifications in the notification drawer

expected to completely remove the number

quocviet1996 commented 4 weeks ago

Same issue, my badge when calling AppBadgePlus.updateBadge(0) on Android doesn't work

windows7lake commented 3 weeks ago

@RuiTB @quocviet1996 Could you please offser me your device brand and os version?

windows7lake commented 3 weeks ago

Starting with Android 8.0 (API level 26), notification badges—also known as notification dots—appear on a launcher icon when the associated app has an active notification. Users can touch & hold the app icon to reveal the notifications, along with any app shortcuts.

RuiTB commented 3 weeks ago

@windows7lake my device is a Samsung a22 5g with Android 13 and One UI 5.1

windows7lake commented 2 weeks ago

@RuiTB Sorry. I had try to figure out a solution to solve this problem. But find no way form samsung develper website. It seems to have nothing to do on it, the badges just control by launcher.

According to the description of the official open document of Android:

Starting with Android 8.0 (API level 26), notification badges—also known as notification dots—appear on a launcher icon when the associated app has an active notification. Users can touch & hold the app icon to reveal the notifications, along with any app shortcuts.

chriskr7 commented 1 week ago

@RuiTB I think You should use system default Badge, actually you should use this package under Android 12. From Android 12, I believe android system manage the badges you should not override it.

  static const int _androidAutoManageBadgeVersion = 31;

  bool get _isAndroidAutoManageBadge {
    final versionString = Platform.operatingSystemVersion.split(' ')[1];
    final versionNumber = int.tryParse(versionString.split('.')[0]) ?? 0;
    return versionNumber >= _androidAutoManageBadgeVersion;
  }

  if (!_isAndroidAutoManageBadge) {
      // process your logic
  }

I hope it helps