How does the current Notification Service handle stale registrations that have been marked as stale?

Clubb, Ken 0 Reputation points

I was hoping to simply send silent push notification to a tag and have Notification Server "mark the stale registrations" and then later (at its convenience?) delete these from its database, so that we can keep our quota. However so far I have not seen any evidence that these registrations are being cleaned up, even for cases where real push notifications have been sent to the tags. I know there are approaches we can take to proactively clean up, but based on what I have read it seems that Notification Hub will take it upon itself to mark stale registrations when they are identified by tag pushes and then delete these during some sort of maintenance cycle. Does anyone know what the real answer is. I prefer to have Microsoft clean these out rather than doing this ourselves.

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
300 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 24,971 Reputation points Microsoft Employee

    Based on your scenario description, I understand you are looking for automated/cleanup from Azure for stale registration. could you please provide more details about your requirement?

    Yes, just to highlight: From this FCM doc - Best practices for FCM registration token management

    • Stale registration tokens are associated with inactive devices that haven’t connected to the Firebase Cloud Messaging (FCM) service for over a month.
    • When tokens reach 270 days of inactivity, FCM considers them expired and marks them as invalid.
    • However, if a device connects again and the app is opened, FCM issues a new token for that app instance.

    Does Notification Hubs detect uninstallation?

    If you stored the device as a Registration, the first time you send to that registration and the PNS responds with an error status code that indicates the device is not valid, the device is deleted from your notification hub. If you stored your devices using the Installation APIs, they are not deleted in the scenario above. This decision was made to preserve tags and other metadata about a particular user that might be relevant if the user reinstalls. For both registrations and installations, you can set an expiration so that the device is automatically cleaned up at a given time. A common pattern is to have your client application update that expiration date once a day to move it back as long as the user is using your application.

    Additionally, please checkout these discussion threads points from our PG -ANH removes the registration containing this invalid device from the backend.

    If my answer helped (pointed, you in the right direction) > please click Accept Answer - it will benefit the community/users to find the answer quickly.

    1 person found this answer helpful.
    0 comments No comments