push notification - Amazon SNS - how to know that app has been uninstalled? -
i new on amazon sns.
i have apps using apns , gcm through amazon sns.
so every time user installs app, register them gcm or apns.
i wanted know when app app has been uninstalled can remove them in database , won't sent push notification.
i read somewhere apple feedback services , gcm returning notregistered
, explanations unclear me can these services , responses?
any appreciated!
thanks.
based blog, in order push mobile notifications app using sns, app’s token needs first registered sns using createplatformendpoint
api method.
the best practice presented below creates working, current, enabled endpoint in wide variety of starting conditions. approach works whether first time app being registered or not, whether or not platformendpoint app exists, , whether or not the endpoint enabled or disabled, or has correct token, , on. approach idempotent. safe run multiple times in row , not create duplicate platformendpoints or alter existing platformendpoint if date , enabled.
retrieve latest token mobile os if (endpoint arn not stored) # first time registration call createplatformendpoint store returned endpoint arn endif call getendpointattributes on endpoint arn if (getting attributes encountered notfound exception) #endpoint deleted call createplatformendpoint store returned endpoint arn else if (token in endpoint not match latest) or (getendpointattributes shows endpoint disabled) call setendpointattributes set latest token , enable endpoint endif endif
Comments
Post a Comment