Update Badge Number when push notification is received when App is not Open
22,264
You need to set a value for the badge
key in your push notification payload. From your description, it sounds like it is only your application which is updating the badge number, and not the notification itself.
See The Notification Payload of the Local and Push Notification Programming Guide for details:
Keys and values of the aps dictionary
badge
(number): The number to display as the badge of the application icon. If this property is absent, the badge is not changed. To remove the badge, set the value of this property to 0.
Author by
user2174560
Updated on July 13, 2022Comments
-
user2174560 almost 2 years
I have an App in which i am facing the issue that the badge number only gets updated when i open the notification but i need to update the badge number even when app is not open.
Can anyone help me with that??
-
user2174560 about 11 yearsWhich methods gets called when Notification Payload is received and App is not open. I am not getting how to update the badgenumber without opening the App.
-
Mike Weller about 11 yearsYour app is not opened and no method is called. You need to specify the badge number in the notification payload. This is sent by your server to apple who then delivers it to the device. Your app is not involved.
-
Mayank Kumar about 7 years@MikeWeller - when app is killed and we send badge with notification payload, app icon badge count setting correctly and we receive an notification alert. is it possible somehow to only update badge count and don't receive push notification as alert? Eg: I have gmail app on my mobile and its killed and if i marked an email read from other mobile or browser. Gmail app icon badge changes to correct number without showing any push notification alert. do you know how to achieve this?