2

I am new on Amazon SNS.

I have apps that are using APNS and GCM through Amazon SNS.

So every time a user installs my app, I would register them into GCM or APNS.

I wanted to know when app my app has been uninstalled so that I can remove them in my database and they won't be sent a push notification.

I read somewhere about Apple Feedback Services and GCM returning NOTREGISTERED, but explanations are very unclear to me like where can I get these services and responses?

Any help is greatly appreciated!

Thanks.

PinoyStackOverflower
  • 5,214
  • 18
  • 63
  • 126

1 Answers1

0

Based from this blog, In order to push mobile notifications to an app using SNS, that app’s token needs to be first registered with SNS using the CreatePlatformEndpoint API method.

The best practice presented below creates a working, current, enabled endpoint in a wide variety of starting conditions. This approach works whether this is a first time the app is being registered or not, whether or not the PlatformEndpoint for this app already exists, and whether or not the endpoint is enabled or disabled, or has the correct token, and so on. The approach is also idempotent. It is safe to run it multiple times in a row and it will not create duplicate PlatformEndpoints or alter an existing PlatformEndpoint if it is already up to date and enabled.

retrieve the latest token from the mobile OS
if (endpoint arn not stored)
    # first time registration
    call CreatePlatformEndpoint
    store returned endpoint arn
endif

call GetEndpointAttributes on the endpoint arn 

if (getting attributes encountered NotFound exception)
    #endpoint was deleted 
    call CreatePlatformEndpoint
    store returned endpoint arn
else 
    if (token in endpoint does not match latest) or 
        (GetEndpointAttributes shows endpoint as disabled)
        call SetEndpointAttributes to set the 
                     latest token and enable the endpoint
    endif
endif
abielita
  • 13,147
  • 2
  • 17
  • 59