Tuesday, June 16, 2015

Integration with Amazon SNS for push notifications

Pseudocode for Android integration with Amazon SNS:
server call to register for push notifications with registration token and DeviceId
if DeviceId is already stored then
    call DeleteEndpoint
else
    call CreatePlatformEndpoint to create new ARN for this device 
    store new ARN, Token and DeviceId
endif
I know there are other algorithms for working with Amazon’s SNS (like this one) but this seems to be the simplest, and it also solves the problem with Amazon not disabling the ARNs when applications are re-installed.
This should work for iOS-SNS integration, but I haven't had the chance to test.