Unable to clear FCM notification badge count on Android in Ioinic Angular App

I am working on an Ionic Angular app using the Firebase FCM for sending push notifications and am using the capacitor badge to clear the count once the user enters/leaves the App. Inside the AndroidNotification interface (which is inside the AndroidConfig interface) is the property notificationCount, for setting the badge count for the App. When I use the clear method on the capacitor badge plugin, it doesn’t clear the push notification count sent through the FCM AndroidNotification interface. However if I set a count through capacitor badge plugin and clear then that works. Specifically here are some of the steps to help clarify –

  1. Send say two push notifications and the App badge count increments to 2
  2. Open the App and trigger the Badge.clear but the badge count of 2 remains unchanged
  3. Open the App again and trigger a Badge.set command to a number say 20
  4. Leave the App and the App badge count shows 20
  5. Now open the App and trigger to clear the badge count through Badge.clear and leave the App
  6. App badge count goes back to 2, the original push notification count, while clearing the 20 that was set through Badge.set

I am trying to understand and clear the badge count set through notificationCount on Android devices. The corresponding set and clear behavior works fine on iOS devices where it clears the push notification count set FCM.

I am not sure but I suspect the Android issue may have something to do with channels in Android. The documentation for AndroidNotification interface includes this for channel id

/**
 * The Android notification channel ID (new in Android O). The app must create
 * a channel with this channel ID before any notification with this channel ID
 * can be received. If you don't send this channel ID in the request, or if the
 * channel ID provided has not yet been created by the app, FCM uses the channel
 * ID specified in the app manifest.
 */
channelId?: string;

There is no channel being created or set so the default behavior seems to be “FCM uses the channel ID specified in the app manifest”. I am not sure what channel id this is referring to as I don’t have anything set in my AndroidManifest.xml file.

My ionic info output is included below for my environment.

Ionic:

   Ionic CLI                     : 7.1.1 (/Users/<username>/.nvm/versions/node/v20.2.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.7.5
   @angular-devkit/build-angular : 16.2.12
   @angular-devkit/schematics    : 16.2.12
   @angular/cli                  : 16.2.12
   @ionic/angular-toolkit        : 6.1.0

Capacitor:

   Capacitor CLI      : 5.7.0
   @capacitor/android : 5.7.0
   @capacitor/core    : 5.7.0
   @capacitor/ios     : 5.7.0

Cordova:

   Cordova CLI       : 12.0.0 ([email protected])
   Cordova Platforms : android 9.1.0, browser 6.0.0, ios 6.2.0
   Cordova Plugins   : cordova-plugin-ionic-webview 4.2.1, (and 3 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : 2.0.1

System:

   ios-sim : 8.0.2
   NodeJS  : v20.2.0 (/Users/<username>/.nvm/versions/node/v20.2.0/bin/node)
   npm     : 9.6.6
   OS      : macOS Unknown
   Xcode   : Xcode 15.4 Build version 15F31d

Looking for help in how to debug the issue. I suspect the push notification uses a different channel for setting badge count while the capacitor badge uses some other channel to set and clear badge counts for Android but I am not sure exactly how that works.

I have posted this issue on the capacitor-plugins project and the corresponding shortCutBadger project but haven’t received any input. Hoping to get some pointers/help here particularly with respect to possible implication of channels in Android.

Thanks,
Sanjay.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật