Integration with Amazon SNS for push notifications

2015/06/16

Categories: Software Mobile Tags: sns amazon push notifications android simple notification service

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

References: DeleteEndpoint, CreatePlatformEndpoint

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.