Pranay Warke on Thu, 23 Apr 2015 21:58:03
Is there any way by which one can detect if an app has been uninstalled.
The closest I could get was to read a 404 response while trying to push a notification to a channel URI.
However a 404 response could also mean the URI has just expired, Any other way to detect app uninstall ?
Any more info on expiration timelines for channel URI could help
Franklin Chen on Fri, 24 Apr 2015 11:18:37
I don't think it's feasible to detect app uninstall by using push notification, as described in this official document: https://msdn.microsoft.com/en-us/library/windows/apps/hh913756.aspx
We do not guarantee that the notification channel URI for an app will always remain the same. We advise that the app requests a new channel every time it runs and updates its service when the URI changes. The developer should never modify the channel URI and should consider it as a black-box string. At this time, channel URIs expire after 30 days. Apps that will periodically renew their channel in the background can follow the pattern demonstrated in the Push and periodic notifications sample.
>>However a 404 response could also mean the URI has just expired
If your cloud service attempts to deliver a notification to an expired channel, WNS will return response code 410. In response to that code, your service should no longer attempt to send notifications to that URI.
I think code 410 should be the right response code to indicate that the channel is expired: https://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx?f=255&MSPPError=-2147217396#WNSResponseCodes
And we need to request a new channel URI if we get this response code.
Code 404 indicates the channel URI is not valid or is not recognized by WNS.
>>Any more info on expiration timelines for channel URI could help
Notification channels automatically expire after 30 days, see here: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh868221(v=win.10).aspx