getGlobalBadgeCounter method

  1. @override
Future<int> getGlobalBadgeCounter()
override

Gets the global badge counter, which represents the number of unread notifications that are currently pending for the app.

This method can be used to retrieve the current value of the app's badge counter, which can be displayed as a badge on the app's icon. Note that the badge counter is specific to the app and is not shared across devices.

It's important to note that the behavior of the badge counter can vary across Android devices. For example, on Xiaomi devices, the badge counter is always the number of notifications displayed in the status bar. On Samsung devices, the badge counter is defined by the application, but is only displayed if there is at least one active notification in the status bar. However, the Awesome Notifications plugin handles these differences transparently, so the developer does not need to worry about them or handle them separately. Instead, the developer can treat the badge counter as it is done in iOS devices.

This method returns a Future that resolves to an integer value indicating the current value of the app's badge counter. If there are no pending notifications, the value will be 0.

Implementation

@override
Future<int> getGlobalBadgeCounter() {
  return AwesomeNotificationsPlatform.instance.getGlobalBadgeCounter();
}