I am looking to set the badge on the app icon on iOS. This can easily be achieved by sending a push notification with badge set which works well when sending a notification of an event where there is a message to show.
I then want to set the badge back to zero when the message has been viewed. I know I can do this with frontend code but I am looking to do this just from the backend to get this live quickly.
This seems to be easy too, I can simply send a push notification with just to and badge set to zero which clears the badge with no notification shown. The only problem is that any Android devices which receive this message get shown a blank notification without any text.
Is there any way to make the notification not appear on Android?
Is there any way of knowing from a push notification token whether it is for Android or iOS. This would allow me to just not send the notification to Android tokens. I have also seen in the documentation that “if [a channel ID] is specified but the corresponding channel does not exist on the device (i.e. has not yet been created by your app), the notification will not be displayed to the user”. This suggests that I can simply set the channel id to something random and the notification will not be displayed. However, this does not seem to be the case and the notification still appears.