g123k / flutter_app_badger

Support to update the app badge on the launcher (both for Android and iOS)
https://pub.dev/packages/flutter_app_badger
Apache License 2.0
307 stars 172 forks source link

Where to add this code if I want to update badge count when notification is received? #6

Open krishnakirana opened 5 years ago

krishnakirana commented 5 years ago

Hi, I want to update the badge count when a notification is received, including following cases

  1. App is terminated.
  2. App is in background.
  3. App is in foreground
parth22 commented 5 years ago

@krishnakirana Me also want same functionality i tried this plugin and didn't work in all the device tell me if you find anything.

eripe970 commented 3 years ago

Isn't the badge something that's send from the backend? I'm using something like below for sending push notification with badge.

    message := &messaging.Message{
        Notification: &messaging.Notification{
            Title: notification.Title,
            Body:  notification.Body,
        },
        Data:  data,
        Token: registrationToken,
        APNS: &messaging.APNSConfig{
            Payload: &messaging.APNSPayload{
                Aps: &messaging.Aps{Badge: &badge},
            },
        },
    }